element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
STM32F4DISCOVERY Expansion Boards
  • Products
  • Dev Tools
  • STM32F4DISCOVERY Expansion Boards
  • More
  • Cancel
STM32F4DISCOVERY Expansion Boards
Forum STM32F4DIS-WIFI - no output from the wifi module
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
STM32F4DISCOVERY Expansion Boards requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 21 replies
  • Subscribers 10 subscribers
  • Views 2365 views
  • Users 0 members are here
  • stm32f4dis_wifi
  • stm32f4discovery
Related

STM32F4DIS-WIFI - no output from the wifi module

roli
roli over 11 years ago

I have just bought the STM32F4DIS-WIFI today and I have some problems getting it to work on my STM32F4 discovery board. The included example is for the MDK-ARM only and I had some trouble building parts of it (mainly the sn8200_core and sn8200_api files) with IAR. I fixed the problem by commenting out the #include <rtl.h> (I believe it's part of the MDK-ARM) and replacing it with this code:

 

#define INADDR_ANY ((unsigned long int) 0x00000000)
#define INADDR_NONE ((unsigned long int) 0xffffffff)
#define    htonl(l) lswap(l)
#define    htons(s) ((unsigned int)(((unsigned int)(s) >> 8) | ((unsigned int)(s) << 8)))
#define    ntohl(l) lswap(l)
#define    ntohs(s) htons(s)

 

I got the code to compile by doing this but it doesn't appear to be working. This is my main function:

void main() {
  //wifi init
  SN8200_API_Init(921600);
  WifiOn(seqNo++);
  GetStatus(seqNo++);
  WifiScan(seqNo++);
  WifiDisconn(seqNo++);
  WifiJoin(seqNo++);
  SnicInit(seqNo++);
  SnicIPConfig(seqNo++);

  while(1) {}
}

 

I didn't use any DBGBU and other functions (and I don't have anything connected to the USART3). IAR provides printf/scanf functions that work with the included debug console so I didn't see any need for that part of the code.

 

The problem that I am having is this: I get no input from the module. For instance the GetStatus function - I get the -GetStatus but not the actual status. The same goes for wifi scan. I never get the actual list of available SSIDs. I can actually disconnect and join the network though. If I enter my SSID, security mode and password then the module connects to the wifi network as expected. So apparently it is geting the data from the board. But I am not sure why I am not getting anything from the module.

  • Sign in to reply
  • Cancel

Top Replies

  • roli
    roli over 11 years ago in reply to roli +1 verified
    Got it. F*** IAR. It was their printf redirect that was making things not work as they should. I redirected that stream to a simple character array instead and what do you know... everything showed up…
Parents
  • aleirlan
    0 aleirlan over 11 years ago

    If you tell me your email , i send you the missing  libraries.

    My email is a.marchesano@hotmail.it

     

    Alessandro



    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • roli
    0 roli over 11 years ago in reply to aleirlan

    Thanks! I've sent you an email.

     

    But I don't think the problem is in those missing libraries. As far as I can understand those are for the high level IP stuff not for the actual wifi module communication. I find it weird that I can connect to a wifi network but I can't get a simple status out of it (or scan results).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • roli
    0 roli over 11 years ago in reply to roli

    I am really getting annoyed by this thing. As expected using the real RTL.h file instead of my substitute didn't make any difference.

     

    But I did a bit more debugging. I checked the actual USART receiving code. When I make a status request/wifi scan I only get 1 byte of data from the module and nothing more. So the communication is obviously working since I can get the module to connect to a network but the module simply isn't sending data back. There is a firmware update bin in the downloaded software and I haven't tried flashing that onto the module yet. And I am not sure if I want to try it because the documentation doesn't tell you anything about what that thing does.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to roli

    I used mkd5-lite and downloaded the older library files that came with mdk4 (the version used for older demo source) - its was titled MDK ARM7/9 Device Support V5.00u1 -equivalent to MDK-ARM 4.73

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • roli
    0 roli over 11 years ago in reply to Former Member

    But is it working properly? As I mentioned before I highly doubt that the problem is with the toolchain. As far as I know that library is only used for a few constants/simple functions in the actual TCP/UDP communication. It has nothing to do with the more low-level functionallity (as far as I know).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to roli

    yes it all worked fine out of the box

    I am actually writing code for the SN8200 unit itself using WICED 2.4.0 from broadcom & olimex openocd JTAG - it serves my purposes better than SNIC and an external processor.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 11 years ago in reply to roli

    yes it all worked fine out of the box

    I am actually writing code for the SN8200 unit itself using WICED 2.4.0 from broadcom & olimex openocd JTAG - it serves my purposes better than SNIC and an external processor.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • roli
    0 roli over 11 years ago in reply to Former Member

    Interesting. Although I wouldn't be surprised if IAR was to blame for the lack of functionallity. Their debugger/compiler/linker sometimes does the wierdest things possible.

     

    But I am sadly stuck with IAR since this is a university project and I don't have that much time to finish this.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to roli

    well I would download the mdk5 just to check if out - its a free download.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • roli
    0 roli over 11 years ago in reply to Former Member

    You are right. I am downloading it right now. Another question - does MDK have anything similar to IAR's implementation debug console? Something that would eliminate the need to use external UART-USB adapter and basically transfers anything written with printf to the that debug console?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to roli

    not sure but stdio is usually easy to redirect in a header or define to a selected com channel. I am hitting the sack for the night. check the help files.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • roli
    0 roli over 11 years ago in reply to Former Member

    Well I've finally tried it today. MDK-ARM is frustrating as *** (and I though IAR was bad) - although it does look nicer and would probably be better if I was used to it. But I did lose my mind trying to redirect printf to the "printf viewer". So I connected an arduino board (without the chip of course) to the USART3 as the example said. And it worked. So the module is ok. It's the code that isn't. I'm going to check that printf redirect in IAR. It could be it's fault.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • roli
    0 roli over 11 years ago in reply to roli

    Got it. F*** IAR. It was their printf redirect that was making things not work as they should. I redirected that stream to a simple character array instead and what do you know... everything showed up. I am still not sure how the printf redirect could be working only partially.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to roli

    Hey,

     

    I have the same problem. On a different project I got the printf to work with IAR by enabling all the libraries (full) in the option settings. However it is asking for the function "htons". Any idea?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to Former Member

    I believe "htons" is in keil  library rlt.h

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to Former Member

    Thanks. I'm actually using IAR. I downloaded the BIN file that came with the module. Nothing works, so I'm trying to compile it now to debug it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • roli
    0 roli over 11 years ago in reply to Former Member

    Here is the part of the RTL.h that is required for the wifi dev module. I modified it so it compiles on IAR and removed most of the things that have nothing to do with networking (although there are still a few useless things in there). Of course I am not sure about licensing issues with this thing.

     

    /*----------------------------------------------------------------------------
     *      RL-ARM - A P I 
     *----------------------------------------------------------------------------
     *      Name:    RTL.H 
     *      Purpose: Application Programming Interface 
     *      Rev.:    V4.72
     *----------------------------------------------------------------------------
     *      This code is part of the RealView Run-Time Library.
     *      Copyright (c) 2004-2013 KEIL - An ARM Company. All rights reserved.
     *---------------------------------------------------------------------------*/
    
    #ifndef __RTL_H__
    #define __RTL_H__
    
    #define __task          __declspec(noreturn)
    #define __used          __attribute__((used))
    
    #ifndef NULL
     #ifdef __cplusplus
      #define NULL          0
     #else
      #define NULL          ((void *) 0)
     #endif
    #endif
    
    #ifndef EOF
     #define EOF            (-1)
    #endif
    /*
    #ifndef __size_t
     #define __size_t       1
     typedef unsigned int   size_t;
    #endif*/
    
    typedef signed char     S8;
    typedef unsigned char   U8;
    typedef short           S16;
    typedef unsigned short  U16;
    typedef int             S32;
    typedef unsigned int    U32;
    typedef long long       S64;
    typedef unsigned long long U64;
    typedef unsigned char   BIT;
    typedef unsigned int    BOOL;
    
    #ifndef __TRUE
     #define __TRUE         1
    #endif
    #ifndef __FALSE
     #define __FALSE        0
    #endif
    
    #ifdef __BIG_ENDIAN
     #define U32_LE(v)      (U32)(__REV(v))
     #define U16_LE(v)      (U16)(__REV(v) >> 16)
     #define U32_BE(v)      (U32)(v)
     #define U16_BE(v)      (U16)(v)
    #else
     #define U32_BE(v)      (U32)(__REV(v))
     #define U16_BE(v)      (U16)(__REV(v) >> 16)
     #define U32_LE(v)      (U32)(v)
     #define U16_LE(v)      (U16)(v)
    #endif
    #define ntohs(v)        U16_BE(v)
    #define ntohl(v)        U32_BE(v)
    #define htons(v)        ntohs(v)
    #define htonl(v)        ntohl(v)
    
    /*----------------------------------------------------------------------------
     *                             RTX Kernel API
     *---------------------------------------------------------------------------*/
    
    #ifdef __cplusplus
    extern "C"  {
    #endif
    
    
    
    
    /*----------------------------------------------------------------------------
     *                             TCPnet API
     *---------------------------------------------------------------------------*/
    
    /* UDP Options */
    #define UDP_OPT_SEND_CS    0x01   /* Calculate Checksum for UDP send frames  */
    #define UDP_OPT_CHK_CS     0x02   /* Verify Checksum for received UDP frames */
    
    /* TCP Socket Types */
    #define TCP_TYPE_SERVER    0x01   /* Socket Type Server (open for listening) */
    #define TCP_TYPE_CLIENT    0x02   /* Socket Type Client (initiate connect)   */
    #define TCP_TYPE_DELAY_ACK 0x04   /* Socket Type Delayed Acknowledge         */
    #define TCP_TYPE_FLOW_CTRL 0x08   /* Socket Type Flow Control                */
    #define TCP_TYPE_KEEP_ALIVE 0x10  /* Socket Type Keep Alive                  */
    #define TCP_TYPE_CLIENT_SERVER (TCP_TYPE_SERVER | TCP_TYPE_CLIENT)
    
    /* TCP Callback Events */
    #define TCP_EVT_CONREQ     0      /* Connect request received event          */
    #define TCP_EVT_CONNECT    1      /* Connection established event            */
    #define TCP_EVT_CLOSE      2      /* Connection was properly closed          */
    #define TCP_EVT_ABORT      3      /* Connection is for some reason aborted   */
    #define TCP_EVT_ACK        4      /* Previously send data acknowledged       */
    #define TCP_EVT_DATA       5      /* Data received event                     */
    
    /* TCP States */
    #define TCP_STATE_FREE     0      /* Entry is free and unused                */
    #define TCP_STATE_CLOSED   1      /* Entry allocated, socket still closed    */
    #define TCP_STATE_LISTEN   2      /* Socket waiting for incoming connection  */
    #define TCP_STATE_SYN_REC  3      /* SYN frame received                      */
    #define TCP_STATE_SYN_SENT 4      /* SYN packet sent to establish a connect. */
    #define TCP_STATE_FINW1    5      /* Tcp_close started FIN packet was sent   */
    #define TCP_STATE_FINW2    6      /* Our FIN ack-ed, waiting for remote FIN  */
    #define TCP_STATE_CLOSING  7      /* Received FIN independently of our FIN   */
    #define TCP_STATE_LAST_ACK 8      /* Waiting for last ACK for our FIN        */
    #define TCP_STATE_TWAIT    9      /* Timed waiting for 2MSL                  */
    #define TCP_STATE_CONNECT  10     /* TCP Connection established              */
    
    /* BSD Socket Address Family */
    #define AF_UNSPEC          0      /* Unspecified                             */
    #define AF_INET            1      /* Internet Address Family (UDP, TCP)      */
    #define AF_NETBIOS         2      /* NetBios-style addresses                 */
    
    /* BSD Protocol families, same as address families */
    #define PF_UNSPEC          AF_UNSPEC
    #define PF_INET            AF_INET
    #define PF_NETBIOS         AF_NETBIOS
    
    /* BSD Socket Type */
    #define SOCK_STREAM        1      /* Stream Socket (Connection oriented)     */
    #define SOCK_DGRAM         2      /* Datagram Socket (Connectionless)        */
    
    /* BSD Socket Protocol */
    #define IPPROTO_TCP        1      /* TCP Protocol                            */
    #define IPPROTO_UDP        2      /* UDP Protocol                            */
    
    /* BSD Internet Addresses */
    #define INADDR_ANY     0x00000000 /* All IP addresses accepted               */
    #define INADDR_NONE    0xffffffff /* No IP address accepted                  */
    
    /* BSD Socket Return values */
    #define SCK_SUCCESS         0     /* Success                                 */
    #define SCK_ERROR         (-1)    /* General Error                           */
    #define SCK_EINVALID      (-2)    /* Invalid socket descriptor               */
    #define SCK_EINVALIDPARA  (-3)    /* Invalid parameter                       */
    #define SCK_EWOULDBLOCK   (-4)    /* It would have blocked.                  */
    #define SCK_EMEMNOTAVAIL  (-5)    /* Not enough memory in memory pool        */
    #define SCK_ECLOSED       (-6)    /* Connection is closed or aborted         */
    #define SCK_ELOCKED       (-7)    /* Socket is locked in RTX environment     */
    #define SCK_ETIMEOUT      (-8)    /* Socket, Host Resolver timeout           */
    #define SCK_EINPROGRESS   (-9)    /* Host Name resolving in progress         */
    #define SCK_ENONAME       (-10)   /* Host Name not existing                  */
    
    /* BSD Socket flags parameter */
    #define MSG_DONTWAIT       0x01   /* Enables non-blocking operation          */
    #define MSG_PEEK           0x02   /* Peeks at the incoming data              */
    
    /* BSD Socket ioctl commands */
    #define FIONBIO            1      /* Set mode (blocking/non-blocking)        */
    #define FIO_DELAY_ACK      2      /* Set DELAY_ACK mode for stream socket    */
    #define FIO_KEEP_ALIVE     3      /* Set KEEP_ALIVE mode for stream socket   */
    #define FIO_FLOW_CTRL      4      /* Set FLOW_CTRL mode for stream socket    */
    
    /* ICMP (ping) Callback Events */
    #define ICMP_EVT_SUCCESS   0      /* Pinged Host responded                   */
    #define ICMP_EVT_TIMEOUT   1      /* Timeout, no ping response received      */
    
    /* DNS Client Callback Events */
    #define DNS_EVT_SUCCESS    0      /* Host name successfully resolved         */
    #define DNS_EVT_NONAME     1      /* DNS Error, no such name                 */
    #define DNS_EVT_TIMEOUT    2      /* Timeout resolving host                  */
    #define DNS_EVT_ERROR      3      /* Erroneous response packet               */
    
    /* DNS 'get_host_by_name()' result codes */
    #define DNS_RES_OK         0      /* Resolver successfully started           */
    #define DNS_ERROR_BUSY     1      /* Resolver busy, can't process request    */
    #define DNS_ERROR_LABEL    2      /* Label in Hostname not valid             */
    #define DNS_ERROR_NAME     3      /* Entire Hostname not valid               */
    #define DNS_ERROR_NOSRV    4      /* Prim. DNS server not specified (0.0.0.0)*/
    #define DNS_ERROR_PARAM    5      /* Invalid parameter                       */
    
    /* SMTP Client Callback Events */
    #define SMTP_EVT_SUCCESS   0      /* Email successfully sent                 */
    #define SMTP_EVT_TIMEOUT   1      /* Timeout sending email                   */
    #define SMTP_EVT_ERROR     2      /* Error when sending email                */
    
    /* FTP Client Commands */
    #define FTPC_CMD_PUT       0      /* Puts a file on FTP server               */
    #define FTPC_CMD_GET       1      /* Retrieves a file from FTP server        */
    #define FTPC_CMD_APPEND    2      /* Append file on FTP server (with create) */
    #define FTPC_CMD_DELETE    3      /* Deletes a file on FTP server            */
    #define FTPC_CMD_LIST      4      /* Lists files stored on FTP server        */
    #define FTPC_CMD_RENAME    5      /* Renames a file on FTP server            */
    #define FTPC_CMD_MKDIR     6      /* Makes a directory on FTP server         */
    #define FTPC_CMD_RMDIR     7      /* Removes an empty directory on FTP server*/
    #define FTPC_CMD_NLIST     8      /* Lists file names only (short format)    */
    
    /* FTP Client Callback Events */
    #define FTPC_EVT_SUCCESS   0      /* File operation successful               */
    #define FTPC_EVT_TIMEOUT   1      /* Timeout on file operation               */
    #define FTPC_EVT_LOGINFAIL 2      /* Login error, username/passw invalid     */
    #define FTPC_EVT_NOACCESS  3      /* File access not allowed                 */
    #define FTPC_EVT_NOTFOUND  4      /* File not found                          */
    #define FTPC_EVT_NOPATH    5      /* Working directory path not found        */
    #define FTPC_EVT_ERRLOCAL  6      /* Local file open error                   */
    #define FTPC_EVT_ERROR     7      /* Generic FTP client error                */
    
    /* TFTP Client Callback Events */
    #define TFTPC_EVT_SUCCESS  0      /* File operation successful               */
    #define TFTPC_EVT_TIMEOUT  1      /* Timeout on file operation               */
    #define TFTPC_EVT_NOACCESS 2      /* File access not allowed                 */
    #define TFTPC_EVT_NOTFOUND 3      /* File not found                          */
    #define TFTPC_EVT_DISKFULL 4      /* Disk full (local or remote)             */
    #define TFTPC_EVT_ERROR    5      /* Generic TFTP client error               */
    
    /* FTP Server Notification events */
    #define FTP_EVT_LOGIN      0      /* User logged in, session is busy         */
    #define FTP_EVT_LOGOUT     1      /* User logged out, session is idle        */
    #define FTP_EVT_LOGFAIL    2      /* User login failed (invalid credentials) */
    #define FTP_EVT_DOWNLOAD   3      /* File download ended                     */
    #define FTP_EVT_UPLOAD     4      /* File upload ended                       */
    #define FTP_EVT_DELETE     5      /* File deleted                            */
    #define FTP_EVT_RENAME     6      /* File or directory renamed               */
    #define FTP_EVT_MKDIR      7      /* Directory created                       */
    #define FTP_EVT_RMDIR      8      /* Directory removed                       */
    #define FTP_EVT_ERRLOCAL   9      /* Local file operation error              */
    #define FTP_EVT_DENIED     10     /* Requested file operation denied         */
    #define FTP_EVT_ERROR      11     /* Generic file operation error            */
    
    /* ARP Cache Entry types */
    #define ARP_FIXED_IP       0      /* Fixed IP adrs is refreshed after tout   */
    #define ARP_TEMP_IP        1      /* Temp adrs is removed after timeout      */
    
    /* BSD Socket typedef's */
    typedef struct sockaddr {         /* << Generic Socket Address structure >>  */
      U16  sa_family;                 /* Address family                          */
      char sa_data[14];               /* Direct address (up to 14 bytes)         */
    } SOCKADDR;
    
    
    
    typedef struct in_addr {          /* << Generic IPv4 Address structure >>    */
      union {
        struct {
          U8 s_b1,s_b2,s_b3,s_b4;     /* IP address, byte access                 */
        };
        struct {
          U16 s_w1,s_w2;              /* IP address, short int access            */
        };
        U32 s_addr;                   /* IP address in network byte order        */
      };
    } IN_ADDR;
    
    
    typedef struct sockaddr_in {      /* << IPv4 Socket Address structure >>     */
      S16 sin_family;                 /* Socket domain                           */
      U16 sin_port;                   /* Port                                    */
      IN_ADDR sin_addr;               /* IP address                              */
      S8  sin_zero[8];                /* reserved                                */
    } SOCKADDR_IN;
    
    typedef struct hostent {          /* << BSD Host Entry structure >>          */
      char *h_name;                   /* Official name of host                   */
      char **h_aliases;               /* Pointer to an array of alias names      */
      S16  h_addrtype;                /* Address Type: AF_INET, AF_NETBIOS       */
      S16  h_length;                  /* Length of address in bytes              */
      char **h_addr_list;             /* Pointer to an array of IPv4 addresses   */
    } HOSTENT;
    
    extern void init_TcpNet (void);
    extern BOOL main_TcpNet (void);
    extern void timer_tick (void);
    extern U8   udp_get_socket (U8 tos, U8 opt, 
                                U16 (*listener)(U8 socket, U8 *remip, U16 port, U8 *buf, U16 len));
    extern BOOL udp_release_socket (U8 socket);
    extern BOOL udp_open (U8 socket, U16 locport);
    extern BOOL udp_close (U8 socket);
    extern BOOL udp_mcast_ttl (U8 socket, U8 ttl);
    extern U8  *udp_get_buf (U16 size);
    extern BOOL udp_send (U8 socket, U8 *remip, U16 remport, U8 *buf, U16 dlen);
    extern U8   tcp_get_socket (U8 type, U8 tos, U16 tout,
                                U16 (*listener)(U8 socket, U8 event, U8 *buf, U16 len));
    extern BOOL tcp_release_socket (U8 socket);
    extern BOOL tcp_listen (U8 socket, U16 locport);
    extern BOOL tcp_connect (U8 socket, U8 *remip, U16 remport, U16 locport);
    extern U8  *tcp_get_buf (U16 size);
    extern U16  tcp_max_dsize (U8 socket);
    extern BOOL tcp_check_send (U8 socket);
    extern U8   tcp_get_state (U8 socket);
    extern BOOL tcp_send (U8 socket, U8 *buf, U16 dlen);
    extern BOOL tcp_close (U8 socket);
    extern BOOL tcp_abort (U8 socket);
    extern void tcp_reset_window (U8 socket);
    extern BOOL arp_cache_ip (U8 *ipadr, U8 type);
    extern BOOL arp_cache_mac (U8 *hwadr);
    extern void ppp_listen (const char *user, const char *passw);
    extern void ppp_connect (const char *dialnum, const char *user, const char *passw);
    extern void ppp_close (void);
    extern BOOL ppp_is_up (void);
    extern void slip_listen (void);
    extern void slip_connect (const char *dialnum);
    extern void slip_close (void);
    extern BOOL slip_is_up (void);
    extern U8   get_host_by_name (U8 *hostn, void (*cbfunc)(U8 event, U8 *host_ip));
    extern BOOL smtp_connect (U8 *ipadr, U16 port, void (*cbfunc)(U8 event));
    extern void dhcp_disable (void);
    extern BOOL igmp_join (U8 *group_ip);
    extern BOOL igmp_leave (U8 *group_ip);
    extern BOOL snmp_trap (U8 *manager_ip, U8 gen_trap, U8 spec_trap, U16 *obj_list);
    extern BOOL snmp_set_community (const char *community);
    extern BOOL icmp_ping (U8 *remip, void (*cbfunc)(U8 event));
    extern BOOL ftpc_connect (U8 *ipadr, U16 port, U8 command, void (*cbfunc)(U8 event));
    extern BOOL tftpc_put (U8 *ipadr, U16 port,
                           const char *src, const char *dst, void (*cbfunc)(U8 event));
    extern BOOL tftpc_get (U8 *ipadr, U16 port, 
                           const char *src, const char *dst, void (*cbfunc)(U8 event));
    extern BOOL sntp_get_time (U8 *ipadr, void (*cbfunc)(U32 utc_time));
    extern void ftp_evt_notify (U8 evt);
    
    /* BSD Socket API */
    extern int  socket (int family, int type, int protocol);
    extern int  bind (int sock, const SOCKADDR *addr, int addrlen);
    extern int  listen (int sock, int backlog);
    extern int  accept (int sock, SOCKADDR *addr, int *addrlen);
    extern int  connect (int sock, SOCKADDR *addr, int addrlen);
    extern int  send (int sock, const char *buf, int len, int flags);
    extern int  sendto (int sock, const char *buf, int len, int flags, SOCKADDR *to, int tolen);
    extern int  recv (int sock, char *buf, int len, int flags);
    extern int  recvfrom (int sock, char *buf, int len, int flags, SOCKADDR *from, int *fromlen);
    extern int  closesocket (int sock);
    extern int  getpeername (int sock, SOCKADDR *name, int *namelen);
    extern int  getsockname (int sock, SOCKADDR *name, int *namelen);
    extern int  ioctlsocket (int sock, long cmd, unsigned long *argp);
    extern HOSTENT *gethostbyname (const char *name, int *err);
    
    #ifdef __cplusplus
    }
    #endif
    
    /*----------------------------------------------------------------------------
     * end of file
     *---------------------------------------------------------------------------*/
    
    #endif

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube