2010年9月29日 星期三

[pic18net] original_web_change_appconfig_procedures

(Based on Microchip TCPIP Stack 5.25v)

http2.C -> case SM_HTTP_PROCESS_POST: -> c = HTTPExecutePost(); -> HTTPExecutePost() -> if(!memcmppgm2ram(filename, "protect/config.htm", 18)) return HTTPPostConfig(); -> HTTPPostConfig() -> //Read all browser POST data from "config.htm" web-page

[pic18net] flag check DHCP disabled or not

(Based on Microchip TCPIP Stack 5.25v)
Key point is this flag check DHCP disabled or not: "AppConfig.Flags.bIsDHCPEnabled"


for DHCP-Client disabled/Off (static IP):
main() function -> InitAppConfig() -> StackInit() -> check if(!AppConfig.Flags.bIsDHCPEnabled).. -> DHCPDisabled(0) -> in the main-Loop -> if(dwLastIP != AppConfig.MyIPAddr.Val) -> finalized the network configuration with static IP.


for DHCP-Client enabled/On (DHCP IP):
main() function -> InitAppConfig() -> StackTask() -> if(AppConfig.Flags.bIsDHCPEnabled).. -> if(DHCPIsBound(0)).. -> get the latest DHCP IP-address configuration -> AppConfig.Flags.bInConfigMode = FALSE; -> in the main-Loop -> if(dwLastIP != AppConfig.MyIPAddr.Val) -> finalized the network configuration with DHCP-Client IP -> in the main-Loop -> if(dwLastIP != AppConfig.MyIPAddr.Val) -> finalized the network configuration with DHCP-Client IP.


note 1 for "AppConfig.Flags.bInConfigMode".

Based on Microchip tcpip stack v5.25, the global flag, "AppConfig.Flags.bInConfigMode" can be considered the network-configuration running or not. While network-configuration running(if (AppConfig.Flags.bInConfigMode == TRUE)), all of the s/w network tcpip stack must not running. After the network-configuration done/finished (if (AppConfig.Flags.bInConfigMode == FALSE)), all the s/w network tcpip stack can run afterwards.


note 2 for "AppConfig.Flags.bInConfigMode".

Based on Microchip tcpip stack v5.25, when DHCP-Client disabled/Off state, there is no setting to have "AppConfig.Flags.bInConfigMode = FALSE;". But when DHCP-Client disabled/On state, "AppConfig.Flags.bInConfigMode = FALSE;" can be found in the function, "StackTask()"..; if(DHCPIsBound(0)) -> AppConfig.Flags.bInConfigMode = FALSE;