Wifi module modification beaglebone black wireless

I really hope someone could help me on this.
I am wondering could I modify the Wifi Module on BeagleBone Black Wireless, e.g., change the MAC layer and application layer of the 802.11 protocol.
If yes, is there any open source code for WiFi?