Look in ieee80211_scan_ap.c in the function ap_end. Channel is selected based on the lowest RSSI detected on a channel. Hope that helps! You can comment out the part of the code that calls the ap_default function or hardest the channel you want it to be.
From: Stratos Keranidis [mailto:email@example.com]
Sent: Monday, March 16, 2009 12:39 PM
Subject: [Madwifi-devel] AP Mode Channel Selection
I sent an e-mail a week ago asking about how to
make the driver working in AP mode select a preselected
channel and not a random one each time i turn it on.
Can someone explain to me the way that this channel selection mechanism
works, or at least where I can find its code?