OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / net / NyLPC_cNetConfig.c
index 5c514e8..653b8e0 100644 (file)
@@ -19,8 +19,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
  *\r
  * For further information please contact.\r
- *     http://nyatla.jp/\r
- *     <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
+ *  http://nyatla.jp/\r
+ *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
  *\r
  *********************************************************************************/\r
 #include "NyLPC_cNetConfig.h"\r
@@ -32,12 +32,12 @@ static void update(NyLPC_TcNetConfig_t* i_inst,const struct NyLPC_TMiMicConfigul
 \r
 void NyLPC_cNetConfig_initialize(NyLPC_TcNetConfig_t* i_inst,NyLPC_TBool i_is_factory_default)\r
 {\r
-       if(i_is_factory_default)\r
-       {\r
-               update(i_inst,NyLPC_cMiMicConfiglation_loadFactoryDefault());\r
-       }else{\r
-               update(i_inst,NyLPC_cMiMicConfiglation_loadFromFlash());\r
-       }\r
+    if(i_is_factory_default)\r
+    {\r
+        update(i_inst,NyLPC_cMiMicConfiglation_loadFactoryDefault());\r
+    }else{\r
+        update(i_inst,NyLPC_cMiMicConfiglation_loadFromFlash());\r
+    }\r
 }\r
 \r
 \r
@@ -48,38 +48,38 @@ void NyLPC_cNetConfig_initialize(NyLPC_TcNetConfig_t* i_inst,NyLPC_TBool i_is_fa
 /*\r
 NyLPC_TBool NyLPC_cNetConfig_saveToOnchipFlash(NyLPC_TcNetConfig_t* i_inst)\r
 {\r
-       NyLPC_TUInt8* pdata;\r
-       NyLPC_TcOnchipFlashWriter_t s;\r
-       struct TNetConfigMemMap tmp;\r
-       NyLPC_cOnchipFlashWriter_initialize(&s);\r
-       //書込みデータを作成\r
-       tmp.fast_boot=0xffffffff;\r
-       tmp.version  =i_inst->version;\r
-       tmp.interface_type=NyLPC_cNetConfig_INTERFACE_TYPE_ETHERNET;\r
-       pdata=i_inst->interface_setting.ethernet.eth_mac.addr;\r
-       tmp.mac_00_01_02_03=(((NyLPC_TUInt32)pdata[0])<<24)|(((NyLPC_TUInt32)pdata[1])<<16)|(((NyLPC_TUInt32)pdata[2])<<8)|(((NyLPC_TUInt32)pdata[3])<<0);\r
-       tmp.mac_04_05_xx_xx=(((NyLPC_TUInt32)pdata[4])<<24)|(((NyLPC_TUInt32)pdata[5])<<16);\r
-       tmp.ipv4_addr_net=i_inst->interface_setting.ethernet.ip_addr.v;\r
-       tmp.ipv4_mask_net=i_inst->interface_setting.ethernet.netmask.v;\r
-       tmp.ipv4_drut_net=i_inst->interface_setting.ethernet.dr_addr.v;\r
+    NyLPC_TUInt8* pdata;\r
+    NyLPC_TcOnchipFlashWriter_t s;\r
+    struct TNetConfigMemMap tmp;\r
+    NyLPC_cOnchipFlashWriter_initialize(&s);\r
+    //書込みデータを作成\r
+    tmp.fast_boot=0xffffffff;\r
+    tmp.version  =i_inst->version;\r
+    tmp.interface_type=NyLPC_cNetConfig_INTERFACE_TYPE_ETHERNET;\r
+    pdata=i_inst->interface_setting.ethernet.eth_mac.addr;\r
+    tmp.mac_00_01_02_03=(((NyLPC_TUInt32)pdata[0])<<24)|(((NyLPC_TUInt32)pdata[1])<<16)|(((NyLPC_TUInt32)pdata[2])<<8)|(((NyLPC_TUInt32)pdata[3])<<0);\r
+    tmp.mac_04_05_xx_xx=(((NyLPC_TUInt32)pdata[4])<<24)|(((NyLPC_TUInt32)pdata[5])<<16);\r
+    tmp.ipv4_addr_net=i_inst->interface_setting.ethernet.ip_addr.v;\r
+    tmp.ipv4_mask_net=i_inst->interface_setting.ethernet.netmask.v;\r
+    tmp.ipv4_drut_net=i_inst->interface_setting.ethernet.dr_addr.v;\r
 \r
-       //イレース\r
-       if(!NyLPC_cOnchipFlashWriter_elase(&s,MIMIC_CONFIGLATION_FLASH_SECTOR,MIMIC_CONFIGLATION_FLASH_SECTOR)){\r
-               NyLPC_OnErrorGoto(Error);\r
-       }\r
-       //コンフィギュレーションを書き込む。\r
-       if(!NyLPC_cOnchipFlashWriter_writeSector(&s,MIMIC_CONFIGLATION_FLASH_SECTOR,0x00000000,&tmp,sizeof(struct TNetConfigMemMap))){\r
-               NyLPC_OnErrorGoto(Error);\r
-       }\r
-       //ユーザコンフィギュレーションをONにする。\r
-       if(setUserConfigulation()){\r
-               NyLPC_OnErrorGoto(Error);\r
-       }\r
-       NyLPC_cOnchipFlashWriter_finalize(&s);\r
-       return NyLPC_TBool_TRUE;\r
+    //イレース\r
+    if(!NyLPC_cOnchipFlashWriter_elase(&s,MIMIC_CONFIGLATION_FLASH_SECTOR,MIMIC_CONFIGLATION_FLASH_SECTOR)){\r
+        NyLPC_OnErrorGoto(Error);\r
+    }\r
+    //コンフィギュレーションを書き込む。\r
+    if(!NyLPC_cOnchipFlashWriter_writeSector(&s,MIMIC_CONFIGLATION_FLASH_SECTOR,0x00000000,&tmp,sizeof(struct TNetConfigMemMap))){\r
+        NyLPC_OnErrorGoto(Error);\r
+    }\r
+    //ユーザコンフィギュレーションをONにする。\r
+    if(setUserConfigulation()){\r
+        NyLPC_OnErrorGoto(Error);\r
+    }\r
+    NyLPC_cOnchipFlashWriter_finalize(&s);\r
+    return NyLPC_TBool_TRUE;\r
 Error:\r
-       NyLPC_cOnchipFlashWriter_finalize(&s);\r
-       return NyLPC_TBool_FALSE;\r
+    NyLPC_cOnchipFlashWriter_finalize(&s);\r
+    return NyLPC_TBool_FALSE;\r
 }\r
 */\r
 \r
@@ -92,26 +92,26 @@ Error:
 #define ETHERNET_FRAME_LEN 1400\r
 static void update(NyLPC_TcNetConfig_t* i_inst,const struct NyLPC_TMiMicConfigulation* pdata)\r
 {\r
-       struct NyLPC_TEthAddr ea;\r
-       struct NyLPC_TIPv4Addr ip,mask,drt;\r
-       //値の読み出し\r
-       ea.addr[0]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>>24)&0xff);\r
-       ea.addr[1]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>>16)&0xff);\r
-       ea.addr[2]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>> 8)&0xff);\r
-       ea.addr[3]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>> 0)&0xff);\r
-       ea.addr[4]=(NyLPC_TUInt8)((pdata->mac_04_05_xx_xx>>24)&0xff);\r
-       ea.addr[5]=(NyLPC_TUInt8)((pdata->mac_04_05_xx_xx>>16)&0xff);\r
-       ip.v=NyLPC_htonl(pdata->ipv4_addr_net);\r
-       mask.v=NyLPC_htonl(pdata->ipv4_mask_net);\r
-       drt.v=NyLPC_htonl(pdata->ipv4_drut_net);\r
-       strcpy(i_inst->hostname,"MiMic");\r
-       NyLPC_cIPv4Config_initialzeForEthernet(&i_inst->super,&ea,ETHERNET_FRAME_LEN);\r
-       NyLPC_cIPv4Config_setDefaultRoute(&i_inst->super,&drt);\r
-       NyLPC_cIPv4Config_setIp(&i_inst->super,&ip,&mask);\r
-       i_inst->services.flags=pdata->srv_flags;\r
-       i_inst->services.http_port=pdata->http_port;\r
-       i_inst->tcp_mode=pdata->ipv4_flags;\r
-       return;\r
+    struct NyLPC_TEthAddr ea;\r
+    struct NyLPC_TIPv4Addr ip,mask,drt;\r
+    //値の読み出し\r
+    ea.addr[0]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>>24)&0xff);\r
+    ea.addr[1]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>>16)&0xff);\r
+    ea.addr[2]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>> 8)&0xff);\r
+    ea.addr[3]=(NyLPC_TUInt8)((pdata->mac_00_01_02_03>> 0)&0xff);\r
+    ea.addr[4]=(NyLPC_TUInt8)((pdata->mac_04_05_xx_xx>>24)&0xff);\r
+    ea.addr[5]=(NyLPC_TUInt8)((pdata->mac_04_05_xx_xx>>16)&0xff);\r
+    ip.v=NyLPC_htonl(pdata->ipv4_addr_net);\r
+    mask.v=NyLPC_htonl(pdata->ipv4_mask_net);\r
+    drt.v=NyLPC_htonl(pdata->ipv4_drut_net);\r
+    strcpy(i_inst->hostname,pdata->hostname);\r
+    NyLPC_cIPv4Config_initialzeForEthernet(&i_inst->super,&ea,ETHERNET_FRAME_LEN);\r
+    NyLPC_cIPv4Config_setDefaultRoute(&i_inst->super,&drt);\r
+    NyLPC_cIPv4Config_setIp(&i_inst->super,&ip,&mask);\r
+    i_inst->services.flags=pdata->srv_flags;\r
+    i_inst->services.http_port=pdata->http_port;\r
+    i_inst->tcp_mode=pdata->ipv4_flags;\r
+    return;\r
 }\r
 \r
 \r