I'm trying to transition beyond Arduino and I'm trying to learn how to use an RTOS (like FreeRTOS) to connect to the web via Wifi. It seems that FreeRTOS and ZentriOS and other RTOS supply TCP/IP stacks. Correct me if I'm wrong but It seems to me that this TCP/IP stack provides the API for interacting with the outside world through either Ethernet or Wifi. Is the Wifi Driver what interfaces the TCP/IP stack with the Wifi Module itself? Does the Wifi Driver implement standard TCP/IP interfaces? Or is it the firmware developers job to figure out how to interact a TCP/IP stack with the wifi driver?
TCP/IP stack is designed to be generic as possible, so applications can interact with various data link protocols such as 802.3 (Ethernet), 802.11 (Wi-Fi), PPP (point-to-point protocol) and so on without needing to know what sort of link they are using..
TCP/IP actually comprises several layers of protocols, e.g.
5. Application DNS, FTP, HTTP, IMAP, POP3, SMTP, SSH, Telnet, SSL, ... 4. Transport TCP, UDP, ... 3. Network IP (IPv4, IPv6), ICMP, ARP, ... 2. Data Link 802.3 (Ethernet), 802.11 (Wi-Fi), PPP, ... 1. Physical Ethernet (NIC), Wireless (NIC), Cat 5/RJ-45, ...
(The top layer is often broken out into three separate ones, I am simplfying things a little.)
So it will be the bottom level where the stack needs to interface with the driver for your specific Wi-Fi module.
Since this is at the byte level, there will be a limited number of functions that needed to be implemented. They follow a pretty much standard I/O device driver model, i.e.
Open function Close function Send function Receive function IO Control function Get PhysicalAddress function Interrupt service routine (ISR) callback
so it should be pretty simply to marry up the stack interface with a particular module.
See here for an example with some more detail for one particular OS.
Some Wi-Fi modules, like the ESP8266, come with a TCP/IP stack built-in, since TCP/IP can be taxing on a small microcontroller. It is accessed via AT commands, much like a cell module or Bluetooth module.