Driver for CC3000 Wi-Fi module

Dependencies:   NVIC_set_all_priorities

Dependents:   CC3000_Simple_Socket Wi-Go_IOT_Demo

Information

The current code has been reworked to a full object oriented application and contains an mbed socket compatible API.

CC3000 Wi-Fi module library

Info

This is the low level driver for TI's SimpleLink CC3000 device.
Port from Avnet's Wi-Go KEIL code (based on TI's CC3000 code).
Special thanks to Jim Carver from Avnet for providing the Wi-Go board and for his assistance.

Differences with TI's original code

The code functionality stays exactly the same.
In order to make it easier to use the code, following changes were made :

  • Addition of a tool to shift all IRQ priorities to a lower level since it is very important to keep the SPI handler at the highest system priority, the WLAN interrupt the second highest and all other system interrupts at a lower priority, so their handlers can be preempted by the CC3000 interrupts.
  • Addition of low level I/O controls and conditional compiler controls in cc3000_common.h.
  • CC3000 initialisation, pin declarations, SPI and WLAN irq priorities are set in Init_HostDriver , we need to call this function at the start of the main function.
  • The SPI and HCI code are joined into one file.
  • The include list has been rearranged - Only #include "wlan.h" is needed in the user API.
  • Part of the CC3000's user eeprom memory is used to store additional info (52 bytes in NVMEM_USER_FILE_1):
# bytesDescriptionInfo
1First time config parameterUseful when connecting
2Firmware updater versionused with the Firmware update tool
2Service Pack versionused with the Firmware update tool
3Driver Versionused with the Firmware update tool
3Firmware Versionused with the Firmware update tool
1CIK validation (Client Interface Key)
40CIK data (Client Interface Key)used with the exosite

Using the Library

A user API is needed to access the CC3000 functions.
Examples:

Using the library with other processors

cc3000_common.cpp loads the irq tool for all targets:
All current mbed targets are supported by this library.

#include "NVIC_set_all_priorities.h"


All low level settings that need to change are available in cc3000_common.h

//*****************************************************************************
//              PIN CONTROLS & COMPILE CONTROLS
//*****************************************************************************
// Compiler control
#define CC3000_UNENCRYPTED_SMART_CONFIG   // No encryption
//#define CC3000_TINY_DRIVER                // Driver for small memory model CPUs

//Interrupt controls
#define NVIC_ALL_IRQ        NVIC_set_all_irq_priorities(3);         // Set ALL interrupt priorities to level 3
#define NVIC_SPI_IRQ        NVIC_SetPriority(SPI0_IRQn, 0x0);       // Wi-Fi SPI interrupt must be higher priority than SysTick
#define NVIC_PORT_IRQ       NVIC_SetPriority(PORTA_IRQn, 0x1);
#define NVIC_SYSTICK_IRQ    NVIC_SetPriority(SysTick_IRQn, 0x2);    // SysTick set to lower priority than Wi-Fi SPI bus interrupt
//#define NVIC_ADC_IRQ        NVIC_SetPriority(ADC0_IRQn, 0x3);       // ADC is the lowest of all

// Wlan controls
#define WLAN_ISF_PCR        PORTA->PCR[16]
#define WLAN_ISF_ISFR       PORTA->ISFR
#define WLAN_ISF_MASK       (1<<16)

#define WLAN_ASSERT_CS      wlan_cs = 0;   //CS : active low
#define WLAN_DEASSERT_CS    wlan_cs = 1;

#define WLAN_ASSERT_EN      wlan_en = 1;   //EN : active high
#define WLAN_DEASSERT_EN    wlan_en = 0;

#define WLAN_READ_IRQ       wlan_int

#define WLAN_ENABLE_IRQ     wlan_int.fall(&WLAN_IRQHandler);
#define WLAN_DISABLE_IRQ    wlan_int.fall(NULL);

#define WLAN_IRQ_PIN_CREATE         InterruptIn wlan_int (PTA16);
#define WLAN_EN_PIN_CREATE          DigitalOut  wlan_en  (PTA13);
#define WLAN_CS_PIN_CREATE          DigitalOut  wlan_cs  (PTD0);
#define WLAN_SPI_PORT_CREATE        SPI wlan(PTD2, PTD3, PTC5); // mosi, miso, sclk

#define WLAN_SPI_PORT_INIT          wlan.format(8,1);
#define WLAN_SPI_SET_FREQ           wlan.frequency(12000000);
#define WLAN_SPI_SET_IRQ_HANDLER    wlan_int.fall(&WLAN_IRQHandler);

#define WLAN_SPI_WRITE              wlan.write(*data++);
#define WLAN_SPI_READ               wlan.write(0x03);          // !! DO NOT MODIFY the 0x03 parameter (CC3000 will not respond).

API documentation

Due to a little problem with the links on the mbed site, the API documentation is not directly accessible (will be solved in a next release).
Currently, it is only accessible by adding modules.html to the API doc link: http://mbed.org/users/frankvnk/code/CC3000_Hostdriver/docs/tip/modules.html

Revision:
5:854f9b13a0f9
Parent:
4:d8255a5aad46
Child:
6:d733efcc2c56
--- a/socket.h	Mon Jul 15 14:19:46 2013 +0000
+++ b/socket.h	Mon Jul 15 19:54:53 2013 +0000
@@ -37,6 +37,13 @@
 
 #include "GlobalAssigns.h"
 
+//*****************************************************************************
+//
+//! \addtogroup socket
+//! @{
+//
+//*****************************************************************************
+
 /** CC3000 Host driver - Socket API
 *
 */
@@ -227,28 +234,28 @@
 //*****************************************************************************
 
 /**
-* HostFlowControlConsumeBuff
-* if SEND_NON_BLOCKING is not defined - block until a free buffer is available,
-* otherwise return the status of the available buffers.
+* HostFlowControlConsumeBuff.
+* if SEND_NON_BLOCKING is not defined - block until a free buffer is available,\n
+* otherwise return the status of the available buffers.\n
 * @param  sd  socket descriptor
-* @return  0 in case there are buffers available, 
-*         -1 in case of bad socket
-*         -2 if there are no free buffers present (only when SEND_NON_BLOCKING is enabled)
+* @return  0 in case there are buffers available, \n
+*         -1 in case of bad socket\n
+*         -2 if there are no free buffers present (only when SEND_NON_BLOCKING is enabled)\n
 */
 int HostFlowControlConsumeBuff(int sd);
 
 /**
-* create an endpoint for communication
-* The socket function creates a socket that is bound to a specific transport service provider.
-* This function is called by the application layer to obtain a socket handle.
-* @param   domain    selects the protocol family which will be used for 
-*                    communication. On this version only AF_INET is supported
-* @param   type      specifies the communication semantics. On this version 
-*                    only SOCK_STREAM, SOCK_DGRAM, SOCK_RAW are supported
-* @param   protocol  specifies a particular protocol to be used with the 
-*                    socket IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW are supported.
-* @return  On success, socket handle that is used for consequent socket 
-*          operations. On error, -1 is returned.
+* create an endpoint for communication.
+* The socket function creates a socket that is bound to a specific transport service provider.\n
+* This function is called by the application layer to obtain a socket handle.\n
+* @param   domain    selects the protocol family which will be used for\n 
+*                    communication. On this version only AF_INET is supported\n
+* @param   type      specifies the communication semantics. On this version\n 
+*                    only SOCK_STREAM, SOCK_DGRAM, SOCK_RAW are supported\n
+* @param   protocol  specifies a particular protocol to be used with the\n 
+*                    socket IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW are supported.\n
+* @return  On success, socket handle that is used for consequent socket operations\n 
+*          On error, -1 is returned.\n
 */
 extern int socket(long domain, long type, long protocol);
 
@@ -260,88 +267,92 @@
 extern long closesocket(long sd);
 
 /**
-* accept a connection on a socket:
-* This function is used with connection-based socket types 
-* (SOCK_STREAM). It extracts the first connection request on the 
-* queue of pending connections, creates a new connected socket, and
-* returns a new file descriptor referring to that socket.
-* The newly created socket is not in the listening state. 
-* The original socket sd is unaffected by this call. 
-* The argument sd is a socket that has been created with socket(),
-* bound to a local address with bind(), and is  listening for 
-* connections after a listen(). The argument addr is a pointer 
-* to a sockaddr structure. This structure is filled in with the 
-* address of the peer socket, as known to the communications layer.
-* The exact format of the address returned addr is determined by the 
-* socket's address family. The addrlen argument is a value-result
-* argument: it should initially contain the size of the structure
-* pointed to by addr, on return it will contain the actual 
-* length (in bytes) of the address returned.
-* @param[in]   sd      socket descriptor (handle)              
-* @param[out]  addr    the argument addr is a pointer to a sockaddr structure
-*                      This structure is filled in with the address of the  
-*                      peer socket, as known to the communications layer.        
-*                      determined. The exact format of the address returned             
-*                      addr is by the socket's address sockaddr. 
-*                      On this version only AF_INET is supported.
-*                      This argument returns in network order.
-* @param[out] addrlen  the addrlen argument is a value-result argument: 
-*                      it should initially contain the size of the structure
-*                      pointed to by addr.
-* @return  For socket in blocking mode:
-*           - On success, socket handle. on failure negative
-*          For socket in non-blocking mode:
-*           - On connection establishment, socket handle
-*           - On connection pending, SOC_IN_PROGRESS (-2)
-*           - On failure, SOC_ERROR    (-1)
+* accept a connection on a socket.
+* This function is used with connection-based socket types\n 
+* (SOCK_STREAM). It extracts the first connection request on the\n 
+* queue of pending connections, creates a new connected socket, and\n
+* returns a new file descriptor referring to that socket.\n
+* The newly created socket is not in the listening state.\n 
+* The original socket sd is unaffected by this call.\n 
+* The argument sd is a socket that has been created with socket(),\n
+* bound to a local address with bind(), and is  listening for \n
+* connections after a listen(). The argument addr is a pointer \n
+* to a sockaddr structure. This structure is filled in with the \n
+* address of the peer socket, as known to the communications layer.\n
+* The exact format of the address returned addr is determined by the \n
+* socket's address family. The addrlen argument is a value-result\n
+* argument: it should initially contain the size of the structure\n
+* pointed to by addr, on return it will contain the actual\n 
+* length (in bytes) of the address returned.\n
+* @param[in]   sd      socket descriptor (handle)\n              
+* @param[out]  addr    the argument addr is a pointer to a sockaddr structure\n
+*                      This structure is filled in with the address of the \n 
+*                      peer socket, as known to the communications layer.  \n      
+*                      determined. The exact format of the address returned \n            
+*                      addr is by the socket's address sockaddr. \n
+*                      On this version only AF_INET is supported.\n
+*                      This argument returns in network order.\n
+* @param[out] addrlen  the addrlen argument is a value-result argument: \n
+*                      it should initially contain the size of the structure\n
+*                      pointed to by addr.\n
+* @return  For socket in blocking mode:\n
+*           - On success, socket handle. on failure negative\n
+*          For socket in non-blocking mode:\n
+*           - On connection establishment, socket handle\n
+*           - On connection pending, SOC_IN_PROGRESS (-2)\n
+*           - On failure, SOC_ERROR    (-1)\n
 * @sa     socket ; bind ; listen
 */
 extern long accept(long sd, sockaddr *addr, socklen_t *addrlen);
 
 /**
-* assign a name to a socket
-* This function gives the socket the local address addr.
-* addr is addrlen bytes long. Traditionally, this is called when a 
-* socket is created with socket, it exists in a name space (address 
-* family) but has no name assigned.
-* It is necessary to assign a local address before a SOCK_STREAM
-* socket may receive connections.
+* assign a name to a socket.
+* This function gives the socket the local address addr.\n
+* addr is addrlen bytes long. Traditionally, this is called when a \n
+* socket is created with socket, it exists in a name space (address \n
+* family) but has no name assigned.\n
+* It is necessary to assign a local address before a SOCK_STREAM\n
+* socket may receive connections.\n
 * @param[in]   sd      socket descriptor (handle)              
-* @param[out]  addr    specifies the destination address. On this version 
-*                      only AF_INET is supported.
-* @param[out] addrlen  contains the size of the structure pointed to by addr.
-* @return      On success, zero is returned. On error, -1 is returned.
+* @param[out]  addr    specifies the destination address. On this version\n 
+*                      only AF_INET is supported.\n
+* @param[out] addrlen  contains the size of the structure pointed to by addr.\n
+* @return      On success, zero is returned.\n
+*              On error, -1 is returned.\n
 * @sa          socket ; accept ; listen
 */
 extern long bind(long sd, const sockaddr *addr, long addrlen);
 
 /**
-* listen for connections on a socket
-* The willingness to accept incoming connections and a queue
-* limit for incoming connections are specified with listen(),
-* and then the connections are accepted with accept.
-* The listen() call applies only to sockets of type SOCK_STREAM
-* The backlog parameter defines the maximum length the queue of
-* pending connections may grow to. 
+* listen for connections on a socket.
+* The willingness to accept incoming connections and a queue\n
+* limit for incoming connections are specified with listen(),\n
+* and then the connections are accepted with accept.\n
+* The listen() call applies only to sockets of type SOCK_STREAM\n
+* The backlog parameter defines the maximum length the queue of\n
+* pending connections may grow to. \n
 * @param[in]  sd       socket descriptor (handle)              
-* @param[in]  backlog  specifies the listen queue depth. On this version
-*                      backlog is not supported.
-* @return     On success, zero is returned. On error, -1 is returned.
+* @param[in]  backlog  specifies the listen queue depth. On this version\n
+*                      backlog is not supported.\n
+* @return     On success, zero is returned.\n
+*             On error, -1 is returned.\n
 * @sa         socket ; accept ; bind
 * @note       On this version, backlog is not supported
 */
 extern long listen(long sd, long backlog);
 
 /**
-* Get host IP by name. Obtain the IP Address of machine on network, 
+* Get host IP by name.\n
+* Obtain the IP Address of machine on network\n
 * @param[in]   hostname     host name              
 * @param[in]   usNameLen    name length 
-* @param[out]  out_ip_addr  This parameter is filled in with host IP address. 
-*                           In case that host name is not resolved, 
-*                           out_ip_addr is zero.                  
-* @return      On success, positive is returned. On error, negative is returned by its name.
-* @note  On this version, only blocking mode is supported. Also note that
-*        The function requires DNS server to be configured prior to its usage.
+* @param[out]  out_ip_addr  This parameter is filled in with host IP address.\n 
+*                           In case that host name is not resolved, \n
+*                           out_ip_addr is zero.\n     
+* @return      On success, positive is returned.\n
+*              On error, negative is returned by its name.\n
+* @note  On this version, only blocking mode is supported. Also note that\n
+*        The function requires DNS server to be configured prior to its usage.\n
 */
 #ifndef CC3000_TINY_DRIVER 
 extern int gethostbyname(char * hostname, unsigned short usNameLen, unsigned long* out_ip_addr);
@@ -349,96 +360,98 @@
 
 
 /**
-* initiate a connection on a socket 
-* Function connects the socket referred to by the socket descriptor 
-* sd, to the address specified by addr. The addrlen argument 
-* specifies the size of addr. The format of the address in addr is 
-* determined by the address space of the socket. If it is of type 
-* SOCK_DGRAM, this call specifies the peer with which the socket is 
-* to be associated; this address is that to which datagrams are to be
-* sent, and the only address from which datagrams are to be received.  
-* If the socket is of type SOCK_STREAM, this call attempts to make a 
-* connection to another socket. The other socket is specified  by 
-* address, which is an address in the communications space of the
-* socket. Note that the function implements only blocking behavior 
-* thus the caller will be waiting either for the connection 
-* establishment or for the connection establishment failure.
+* initiate a connection on a socket.
+* Function connects the socket referred to by the socket descriptor\n 
+* sd, to the address specified by addr. The addrlen argument \n
+* specifies the size of addr. The format of the address in addr is \n
+* determined by the address space of the socket. If it is of type \n
+* SOCK_DGRAM, this call specifies the peer with which the socket is \n
+* to be associated; this address is that to which datagrams are to be\n
+* sent, and the only address from which datagrams are to be received. \n 
+* If the socket is of type SOCK_STREAM, this call attempts to make a \n
+* connection to another socket. The other socket is specified  by \n
+* address, which is an address in the communications space of the\n
+* socket. Note that the function implements only blocking behavior \n
+* thus the caller will be waiting either for the connection \n
+* establishment or for the connection establishment failure.\n
 * @param[in]   sd       socket descriptor (handle)         
-* @param[in]   addr     specifies the destination addr. On this version
-*                       only AF_INET is supported.
+* @param[in]   addr     specifies the destination addr. On this version\n
+*                       only AF_INET is supported.\n
 * @param[out]  addrlen  contains the size of the structure pointed to by addr    
-* @return      On success, zero is returned. On error, -1 is returned
+* @return      On success, zero is returned.\n
+               On error, -1 is returned\n
 * @sa socket
 */
 extern long connect(long sd, const sockaddr *addr, long addrlen);
 
 /**
-* Monitor socket activity  
-* Select allow a program to monitor multiple file descriptors,
-* waiting until one or more of the file descriptors become 
-*"ready" for some class of I/O operation 
-* @param[in]    nfds       the highest-numbered file descriptor in any of the
-*                          three sets, plus 1.     
-* @param[out]   writesds   socket descriptors list for write monitoring
-* @param[out]   readsds    socket descriptors list for read monitoring  
-* @param[out]   exceptsds  socket descriptors list for exception monitoring
-* @param[in]    timeout    is an upper bound on the amount of time elapsed
-*                          before select() returns. Null means infinity 
-*                          timeout. The minimum timeout is 5 milliseconds,
-*                         less than 5 milliseconds will be set
-*                          automatically to 5 milliseconds.
-* @return    On success, select() returns the number of file descriptors
-*            contained in the three returned descriptor sets (that is, the
-*            total number of bits that are set in readfds, writefds,
-*            exceptfds) which may be zero if the timeout expires before
-*            anything interesting  happens.
-*            On error, -1 is returned.
-*                  *readsds - return the sockets on which Read request will
-*                             return without delay with valid data.
-*                  *writesds - return the sockets on which Write request 
-*                                will return without delay.
-*                  *exceptsds - return the sockets which closed recently.
-* @Note   If the timeout value set to less than 5ms it will automatically
-*         change to 5ms to prevent overload of the system
+* Monitor socket activity. 
+* Select allow a program to monitor multiple file descriptors,\n
+* waiting until one or more of the file descriptors become \n
+*"ready" for some class of I/O operation \n
+* @param[in]    nfds       the highest-numbered file descriptor in any of the\n
+*                          three sets, plus 1.  \n   
+* @param[out]   writesds   socket descriptors list for write monitoring\n
+* @param[out]   readsds    socket descriptors list for read monitoring\n  
+* @param[out]   exceptsds  socket descriptors list for exception monitoring\n
+* @param[in]    timeout    is an upper bound on the amount of time elapsed\n
+*                          before select() returns. Null means infinity \n
+*                          timeout. The minimum timeout is 5 milliseconds,\n
+*                         less than 5 milliseconds will be set\n
+*                          automatically to 5 milliseconds.\n
+* @return    On success, select() returns the number of file descriptors\n
+*            contained in the three returned descriptor sets (that is, the\n
+*            total number of bits that are set in readfds, writefds,\n
+*            exceptfds) which may be zero if the timeout expires before\n
+*            anything interesting  happens.\n
+*            On error, -1 is returned.\n
+*                  *readsds - return the sockets on which Read request will\n
+*                             return without delay with valid data.\n
+*                  *writesds - return the sockets on which Write request \n
+*                                will return without delay.\n
+*                  *exceptsds - return the sockets which closed recently.\n
+* @Note   If the timeout value set to less than 5ms it will automatically\n
+*         change to 5ms to prevent overload of the system\n
 * @sa socket
 */
 extern int select(long nfds, fd_set *readsds, fd_set *writesds, fd_set *exceptsds, struct timeval *timeout);
 
 /**
-* set socket options
-* This function manipulate the options associated with a socket.
-* Options may exist at multiple protocol levels; they are always
-* present at the uppermost socket level.
-* When manipulating socket options the level at which the option 
-* resides and the name of the option must be specified.  
-* To manipulate options at the socket level, level is specified as 
-* SOL_SOCKET. To manipulate options at any other level the protocol 
-* number of the appropriate protocol controlling the option is 
-* supplied. For example, to indicate that an option is to be 
-* interpreted by the TCP protocol, level should be set to the 
-* protocol number of TCP; 
-* The parameters optval and optlen are used to access optval - 
-* use for setsockopt(). For getsockopt() they identify a buffer
-* in which the value for the requested option(s) are to 
-* be returned. For getsockopt(), optlen is a value-result 
-* parameter, initially containing the size of the buffer 
-* pointed to by option_value, and modified on return to 
-* indicate the actual size of the value returned. If no option 
-* value is to be supplied or returned, option_value may be NULL.
+* set socket options.
+* This function manipulate the options associated with a socket.\n
+* Options may exist at multiple protocol levels; they are always\n
+* present at the uppermost socket level.\n
+* When manipulating socket options the level at which the option \n
+* resides and the name of the option must be specified.\n
+* To manipulate options at the socket level, level is specified as\n 
+* SOL_SOCKET. To manipulate options at any other level the protocol \n
+* number of the appropriate protocol controlling the option is \n
+* supplied. For example, to indicate that an option is to be \n
+* interpreted by the TCP protocol, level should be set to the \n
+* protocol number of TCP; \n
+* The parameters optval and optlen are used to access optval - \n
+* use for setsockopt(). For getsockopt() they identify a buffer\n
+* in which the value for the requested option(s) are to \n
+* be returned. For getsockopt(), optlen is a value-result \n
+* parameter, initially containing the size of the buffer \n
+* pointed to by option_value, and modified on return to \n
+* indicate the actual size of the value returned. If no option \n
+* value is to be supplied or returned, option_value may be NULL.\n
 * @param[in]   sd          socket handle
 * @param[in]   level       defines the protocol level for this option
 * @param[in]   optname     defines the option name to Interrogate
 * @param[in]   optval      specifies a value for the option
 * @param[in]   optlen      specifies the length of the option value
-* @return      On success, zero is returned. On error, -1 is returned
+* @return      On success, zero is returned.\n
+               On error, -1 is returned\n
 *
-* @Note   On this version the following two socket options are enabled:
-*         The only protocol level supported in this version is SOL_SOCKET (level).
-*              1. SOCKOPT_RECV_TIMEOUT (optname)
-*                 SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout in milliseconds.
-*                 In that case optval should be pointer to unsigned long.
-*              2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on or off.
-*                 In that case optval should be SOCK_ON or SOCK_OFF (optval).
+* @Note   On this version the following two socket options are enabled:\n
+*         The only protocol level supported in this version is SOL_SOCKET (level).\n
+*              1. SOCKOPT_RECV_TIMEOUT (optname)\n
+*                 SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout in milliseconds.\n
+*                 In that case optval should be pointer to unsigned long.\n
+*              2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on or off.\n
+*                 In that case optval should be SOCK_ON or SOCK_OFF (optval).\n
 * @sa getsockopt
 */
 #ifndef CC3000_TINY_DRIVER 
@@ -446,26 +459,26 @@
 #endif
 
 /**
-* get socket options
-* This function manipulate the options associated with a socket.
-* Options may exist at multiple protocol levels; they are always
-* present at the uppermost socket level.
-* When manipulating socket options the level at which the option 
-* resides and the name of the option must be specified.  
-* To manipulate options at the socket level, level is specified as 
-* SOL_SOCKET. To manipulate options at any other level the protocol 
-* number of the appropriate protocol controlling the option is 
-* supplied. For example, to indicate that an option is to be 
-* interpreted by the TCP protocol, level should be set to the 
-* protocol number of TCP; 
-* The parameters optval and optlen are used to access optval - 
-* use for setsockopt(). For getsockopt() they identify a buffer
-* in which the value for the requested option(s) are to 
-* be returned. For getsockopt(), optlen is a value-result 
-* parameter, initially containing the size of the buffer 
-* pointed to by option_value, and modified on return to 
-* indicate the actual size of the value returned. If no option 
-* value is to be supplied or returned, option_value may be NULL.
+* get socket options.
+* This function manipulate the options associated with a socket.\n
+* Options may exist at multiple protocol levels; they are always\n
+* present at the uppermost socket level.\n
+* When manipulating socket options the level at which the option \n
+* resides and the name of the option must be specified.  \n
+* To manipulate options at the socket level, level is specified as \n
+* SOL_SOCKET. To manipulate options at any other level the protocol \n
+* number of the appropriate protocol controlling the option is \n
+* supplied. For example, to indicate that an option is to be \n
+* interpreted by the TCP protocol, level should be set to the \n
+* protocol number of TCP; \n
+* The parameters optval and optlen are used to access optval -\n 
+* use for setsockopt(). For getsockopt() they identify a buffer\n
+* in which the value for the requested option(s) are to \n
+* be returned. For getsockopt(), optlen is a value-result \n
+* parameter, initially containing the size of the buffer \n
+* pointed to by option_value, and modified on return to \n
+* indicate the actual size of the value returned. If no option \n
+* value is to be supplied or returned, option_value may be NULL.\n
 * @param[in]   sd          socket handle
 * @param[in]   level       defines the protocol level for this option
 * @param[in]   optname     defines the option name to Interrogate
@@ -473,22 +486,22 @@
 * @param[out]  optlen      specifies the length of the option value
 * @return      On success, zero is returned. On error, -1 is returned
 *
-* @Note   On this version the following two socket options are enabled:
-*         The only protocol level supported in this version is SOL_SOCKET (level).
-*              1. SOCKOPT_RECV_TIMEOUT (optname)
-*                 SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout in milliseconds.
-*                 In that case optval should be pointer to unsigned long.
-*              2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on or off.
-*                 In that case optval should be SOCK_ON or SOCK_OFF (optval).
+* @Note   On this version the following two socket options are enabled:\n
+*         The only protocol level supported in this version is SOL_SOCKET (level).\n
+*              1. SOCKOPT_RECV_TIMEOUT (optname)\n
+*                 SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout in milliseconds.\n
+*                 In that case optval should be pointer to unsigned long.\n
+*              2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on or off.\n
+*                 In that case optval should be SOCK_ON or SOCK_OFF (optval).\n
 * @sa setsockopt
 */
 extern int getsockopt(long sd, long level, long optname, void *optval, socklen_t *optlen);
 
 /**
-* Read data from socket (simple_link_recv)
-* Return the length of the message on successful completion.
-* If a message is too long to fit in the supplied buffer, excess bytes may
-* be discarded depending on the type of socket the message is received from.
+* Read data from socket (simple_link_recv).
+* Return the length of the message on successful completion.\n
+* If a message is too long to fit in the supplied buffer, excess bytes may\n
+* be discarded depending on the type of socket the message is received from.\n
 * @param sd       socket handle
 * @param buf      read buffer
 * @param len      buffer length
@@ -500,13 +513,13 @@
 int simple_link_recv(long sd, void *buf, long len, long flags, sockaddr *from, socklen_t *fromlen, long opcode);
 
 /**
-* Receive a message from a connection-mode socket
+* Receive a message from a connection-mode socket.
 * @param[in]  sd     socket handle
 * @param[out] buf    Points to the buffer where the message should be stored
-* @param[in]  len    Specifies the length in bytes of the buffer pointed to 
-*                    by the buffer argument.
-* @param[in] flags   Specifies the type of message reception. 
-*                    On this version, this parameter is not supported.
+* @param[in]  len    Specifies the length in bytes of the buffer pointed to \n
+*                    by the buffer argument.\n
+* @param[in] flags   Specifies the type of message reception. \n
+*                    On this version, this parameter is not supported.\n
 * @return         Return the number of bytes received, or -1 if an error occurred
 * @sa recvfrom
 * @Note On this version, only blocking mode is supported.
@@ -514,18 +527,18 @@
 extern int recv(long sd, void *buf, long len, long flags);
 
 /**
-* read data from socket (recvfrom)
-* Receives a message from a connection-mode or connectionless-mode socket.
-* Note that raw sockets are not supported.
+* read data from socket (recvfrom).
+* Receives a message from a connection-mode or connectionless-mode socket.\n
+* Note that raw sockets are not supported.\n
 * @param[in]  sd       socket handle
 * @param[out] buf      Points to the buffer where the message should be stored
-* @param[in]  len      Specifies the length in bytes of the buffer pointed to 
-*                      by the buffer argument.
-* @param[in] flags     Specifies the type of message reception. 
-*                      On this version, this parameter is not supported.
-* @param[in] from      pointer to an address structure indicating the source
-*                      address: sockaddr. On this version only AF_INET is
-*                      supported.
+* @param[in]  len      Specifies the length in bytes of the buffer pointed to \n
+*                      by the buffer argument.\n
+* @param[in] flags     Specifies the type of message reception.\n 
+*                      On this version, this parameter is not supported.\n
+* @param[in] from      pointer to an address structure indicating the source\n
+*                      address: sockaddr. On this version only AF_INET is\n
+*                      supported.\n
 * @param[in] fromlen   source address structure size
 * @return              Return the number of bytes received, or -1 if an error occurred
 * @sa recv
@@ -534,16 +547,16 @@
 extern int recvfrom(long sd, void *buf, long len, long flags, sockaddr *from, socklen_t *fromlen);
 
 /**
-* Transmit a message to another socket (simple_link_send)
+* Transmit a message to another socket (simple_link_send).
 * @param sd       socket handle
 * @param buf      write buffer
 * @param len      buffer length
 * @param flags    On this version, this parameter is not supported
 * @param to       pointer to an address structure indicating destination address
 * @param tolen    destination address structure size
-* @return         Return the number of bytes transmitted, or -1 if an error
-*                 occurred, or -2 in case there are no free buffers available
-*                 (only when SEND_NON_BLOCKING is enabled)
+* @return         Return the number of bytes transmitted, or -1 if an error\n
+*                 occurred, or -2 in case there are no free buffers available\n
+*                 (only when SEND_NON_BLOCKING is enabled)\n
 */
 int simple_link_send(long sd, const void *buf, long len, long flags, const sockaddr *to, long tolen, long opcode);
 
@@ -553,8 +566,8 @@
 * @param buf      Points to a buffer containing the message to be sent
 * @param len      message size in bytes
 * @param flags    On this version, this parameter is not supported
-* @return         Return the number of bytes transmitted, or -1 if an
-*                 error occurred
+* @return         Return the number of bytes transmitted, or -1 if an\n
+*                 error occurred\n
 * @Note           On this version, only blocking mode is supported.
 * @sa             sendto
 */
@@ -566,9 +579,9 @@
 * @param buf      Points to a buffer containing the message to be sent
 * @param len      message size in bytes
 * @param flags    On this version, this parameter is not supported
-* @param to       pointer to an address structure indicating the destination
-*                 address: sockaddr. On this version only AF_INET is
-*                 supported.
+* @param to       pointer to an address structure indicating the destination\n
+*                 address: sockaddr. On this version only AF_INET is\n
+*                 supported.\n
 * @param tolen    destination address structure size
 * @return         Return the number of bytes transmitted, or -1 if an error occurred
 * @Note           On this version, only blocking mode is supported.
@@ -579,11 +592,11 @@
 /**
 * Set CC3000 in mDNS advertiser mode in order to advertise itself.
 * @param[in] mdnsEnabled         flag to enable/disable the mDNS feature
-* @param[in] deviceServiceName   Service name as part of the published
-*                                canonical domain name
+* @param[in] deviceServiceName   Service name as part of the published\n
+*                                canonical domain name\n
 * @param[in] deviceServiceNameLength   Length of the service name
-* @return   On success, zero is returned, return SOC_ERROR if socket was not 
-*           opened successfully, or if an error occurred.
+* @return   On success, zero is returned,\n
+*           return SOC_ERROR if socket was not opened successfully, or if an error occurred.\n
 */
 extern int mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned short deviceServiceNameLength);
 
@@ -592,6 +605,13 @@
 }
 #endif // __cplusplus
 
+//*****************************************************************************
+//
+// Close the Doxygen group.
+//! @}
+//
+//*****************************************************************************
+
 #endif // __SOCKET_H__