1 #include <system_def.h>
3 #include <hal_machperiph.h>
11 int timer_led_usbact_off;
12 int timer_led_usbconfigured;
17 #ifndef APPL_WITH_SIM_POSIX
18 if (timer_led_usbact_off!=0) timer_led_usbact_off--;
19 else SET_OUT_PIN(LED_PORT,LED2_BIT);
25 #endif /*APPL_WITH_ULAN*/
26 if (timer_led_usbconfigured!=0) timer_led_usbconfigured--;
28 timer_led_usbconfigured=20;
29 if (1 /*!ul_dcnv_is_open(&ep1_dcnv_state)*/) {
30 if(GET_IN_PIN(LED_PORT,LED1_BIT))
31 CLR_OUT_PIN(LED_PORT,LED1_BIT);
33 SET_OUT_PIN(LED_PORT,LED1_BIT);
36 #endif /*APPL_WITH_SIM_POSIX*/
44 lt_mstime_t led1_time;
45 lt_mstime_t led2_time;
49 led1_time=actual_msec;
50 led2_time=actual_msec;
52 while(!app_exit_request){
55 if (lt_10msec_expired(10)) {
58 #ifdef CONFIG_OC_MWENGINE
59 appl_update_indicators();
60 #endif /*CONFIG_OC_MWENGINE*/
62 #ifdef WATCHDOG_ENABLED
64 #endif /* WATCHDOG_ENABLED */
68 if (ul_inepoll(ul_fd)>0) {
71 /* processing of ulan messages */
72 if (ul_acceptmsg(ul_fd, &umsginfo)<0)
73 break; /* No mesage reported - break */
75 if (umsginfo.flg&(UL_BFL_PROC|UL_BFL_FAIL))
76 break; /* Reported message informs about fault or carried out processing */
78 if(umsginfo.cmd==uloi_con_ulan_cmd(coninfo)){
79 if (uloi_process_msg(ULOI_ARG_coninfo (uloi_objdes_array_t*)&uloi_objdes_main, &umsginfo)>=0)
84 if (umsginfo.cmd==UL_CMD_NCS) {
85 if(uldy_process_msg(ULDY_ARG_ul_dyac &umsginfo)>=0)
89 #endif /*CONFIG_ULAN_DY*/
97 /* test request for address */
98 if (uldy_rqa(ULDY_ARG1_ul_dyac))
99 uldy_addr_rq(ULDY_ARG1_ul_dyac);
100 #endif /*CONFIG_ULAN_DY*/
101 #endif /*APPL_WITH_ULAN*/
104 if((lt_msdiff_t)(actual_msec-ltime) > 5000){
109 #ifdef APPL_RUN_AT_MAIN_LOOP
110 APPL_RUN_AT_MAIN_LOOP;
111 #endif /*APPL_RUN_AT_MAIN_LOOP*/
113 #ifdef CONFIG_OC_MWENGINE
115 #endif /*CONFIG_OC_MWENGINE*/
118 if(usb_enable_flag) {
119 if(usb_app_poll()>0) {
120 timer_led_usbact_off=5;
121 CLR_OUT_PIN(LED_PORT,LED2_BIT);
124 #endif /*APPL_WITH_USB*/
126 #ifdef CONFIG_OC_CMDPROC
128 #endif /*CONFIG_OC_CMDPROC*/
130 #ifdef APPL_WITH_DISTORE_EEPROM_USER
131 appl_distore_user_change_check();
132 #endif /*APPL_WITH_DISTORE_EEPROM_USER*/