Status_t Do_IR_Debug(Cmd_Tbl_t *Cmd_Tbl, uint32 flag, uint32 argc, char *argv[]) { FuncIN(DO_IR_DEBUG); if(argc > 0) { switch(atoi(argv[0])) { case 0: IR_Received_Debug_Set_State(DISABLE); printcmd("\r # IR Received sequence debug Disabled!\n"); break; case 1: printcmd("\r # IR Received sequence debug Enabled!\n"); IR_Received_Debug_Set_State(ENABLE); break; default: EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_IR_DEBUG); } // switch(argv[0]) } else EXIT_FUNC(CMD_MISSING_ARGUMENT, DO_IR_DEBUG); EXIT_SUCCESS_FUNC(DO_IR_DEBUG); }
void foo(void) { ENTER_FUNC(); static int z = 350; int q = 450; if (!kitsune_is_updating()) { y = 202; z = 302; q = 402; } NOTE_AND_MIGRATE_STATIC(y); NOTE_AND_MIGRATE_LOCAL_STATIC(foo, z); NOTE_AND_MIGRATE_LOCAL(q); if (kitsune_is_updating()) { assert(y == 207); assert(z == 307); assert(q == 407); printf("Sucesss...\n"); } kitsune_update("test"); EXIT_FUNC(); return; }
void Task2(void *arg) { //printf("parameter: %d\n", *(int*)arg); int i=50; ENTER_FUNC(); while (i--) { printf("This is %s\n", FUNC_NAME); SLEEP(2); } EXIT_FUNC(); }
static int mt_golden_setting_init(void) { #if defined(CONFIG_MT_ENG_BUILD) #define GOLDEN_SETTING_BUF_SIZE (2 * PAGE_SIZE) unsigned int *buf; buf = kmalloc(GOLDEN_SETTING_BUF_SIZE, GFP_KERNEL); if (NULL != buf) { _golden_setting_init(&_golden, buf, GOLDEN_SETTING_BUF_SIZE); #ifdef CONFIG_OF _golden.phy_base = 0; _golden.io_base = 0; #endif { struct proc_dir_entry *dir = NULL; int i; const struct { const char *name; const struct file_operations *fops; } entries[] = { PROC_ENTRY(golden_test), }; dir = proc_mkdir("golden", NULL); if (!dir) { clk_err("[%s]: fail to mkdir /proc/golden\n", __func__); EXIT_FUNC(FUNC_LV_API); return -ENOMEM; } for (i = 0; i < ARRAY_SIZE(entries); i++) { if (!proc_create(entries[i].name, S_IRUGO | S_IWUSR | S_IWGRP, dir, entries[i].fops)) clk_err("[%s]: fail to mkdir /proc/golden/%s\n", __func__, entries[i].name); } } } #endif // CONFIG_MT_ENG_BUILD return 0; }
/******************************************************************************* * Function for register delayed work function * @uint32 Delay: Delay value micro seconds * @void (*)(void *) Callback: Work function callback. This function is * called in interrupt context. * This function must have '__arm' flag! ******************************************************************************/ Status_t Delay_Work(const uint32 Delay, void (*Callback)(void *)) { FuncIN(DELAY_WORK); Status_t Status; int i; uint32 AbsDelay; ASSERT(Callback != NULL, -INVALID_INPUT_POINTER); __disable_interrupt(); AbsDelay = DELAY_TIMER_GET_COUNTER() + Delay; if(AbsDelay > DELAY_TIMER_RESET_VALUE) AbsDelay -= DELAY_TIMER_RESET_VALUE; for(i = 0; i < DELAY_WORK_BUFFER_SIZE; i++) { if(DelayWork[i].Callback == NULL) { DelayWork[i].Delay = Delay; DelayWork[i].AbsDelay = AbsDelay; DelayWork[i].Callback = Callback; break; } } if(i == DELAY_WORK_BUFFER_SIZE) { __enable_interrupt(); EXIT_FUNC(DELAY_QUEUE_FULL , DELAY_WORK); } qsort(DelayWork, DELAY_WORK_BUFFER_SIZE, sizeof(DelayWork_t), Compare_DelayWork); Status = Delay_Timer_Set_Match_0(DelayWork[0].AbsDelay, Delay_ISR); __enable_interrupt(); VERIFY(Status, Status); EXIT_SUCCESS_FUNC(DELAY_WORK); }
Status_t Do_Time(Cmd_Tbl_t *Cmd_Tbl, uint32 flag, uint32 argc, char *argv[]) { FuncIN(DO_TIME); char String[32] = {0}; RtcTime_t Time; RTC_Get_Time(&Time); if(argc > 0) { if(strstr(argv[0], "-a") != NULL) ASSERT(SUCCESS == Format_Time(2, &Time, String), -RTC_GENERAL_ERROR); else EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_TIME); } else ASSERT(SUCCESS == Format_Time(1, &Time, String), -RTC_GENERAL_ERROR); printcmd("\r # %s\n", String); EXIT_SUCCESS_FUNC(DO_TIME); }
Status_t Do_Try_Read_Time_Response_Cmd(char *argv, TimeAlarm_t *TimeAlarm_p) { FuncIN(DO_TRY_READ_TIME_RESPONSE_CMD); ASSERT(argv != NULL, -INVALID_INPUT_POINTER); ASSERT(TimeAlarm_p != NULL, -INVALID_INPUT_POINTER); char *CommandString = NULL; int i; CommandString = strstr(argv, "response="); if(CommandString != NULL) { TimeAlarm_p -> Callback = NULL; CMD_TIMEA_DEBUG(printcmd("\r # (%s) 'response' found!\n", __func__)); for(i = 0; AlarmResponse[i].String != NULL; i++) { if(!strcmp(AlarmResponse[i].String, CommandString + 9)) { TimeAlarm_p -> Callback = AlarmResponse[i].Callback; CMD_TIMEA_DEBUG(printcmd("\r # (%s) 'response' matched to '%s'\n", __func__, AlarmResponse[i].String)); } } if(TimeAlarm_p -> Callback == NULL) { printcmd(" # Invalid 'response' parameter!\n"); EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_TRY_READ_TIME_RESPONSE_CMD); } } // if(CommandString != NULL) EXIT_SUCCESS_FUNC(DO_TRY_READ_TIME_RESPONSE_CMD); }
static int golden_test_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos) { char *buf = _copy_from_user_for_proc(buffer, count); char cmd[64]; unsigned int addr; unsigned int mask; unsigned int golden_val; ENTER_FUNC(FUNC_LV_BODY); // set golden setting (hex mode) if (sscanf(buf, "0x%x 0x%x 0x%x", &addr, &mask, &golden_val) == 3) _golden_setting_add(&_golden, addr, mask, golden_val); // set golden setting (dec mode) else if (sscanf(buf, "%d %d %d", &addr, &mask, &golden_val) == 3) _golden_setting_add(&_golden, addr, mask, golden_val); // set filter (func + line) else if (sscanf(buf, "filter %63s %d", _golden.func, &_golden.line) == 2) { // XXX: 63 = sizeof(_golden.func) - 1 } // set filter (func) else if (sscanf(buf, "filter %63s", _golden.func) == 1) // XXX: 63 = sizeof(_golden.func) - 1 _golden.line = 0; // set golden setting (mixed mode) else if (sscanf(buf, "0x%x 0b%63s", &addr, cmd) == 2) { // XXX: 63 = sizeof(cmd) - 1 if (!_parse_mask_val(cmd, &mask, &golden_val)) _golden_setting_add(&_golden, addr, mask, golden_val); } // set reg value (mask mode) else if (sscanf(buf, "set 0x%x 0x%x 0x%x", &addr, &mask, &golden_val) == 3) _golden_write_reg(addr, mask, golden_val); // set reg value (bit mode) else if (sscanf(buf, "set 0x%x %d %d", &addr, &mask, &golden_val) == 3) { if (0 <= mask && mask <= 31) { // XXX: mask is bit number (alias) golden_val = (golden_val & BIT(0)) << mask; mask = BIT(0) << mask; _golden_write_reg(addr, mask, golden_val); } } // set reg value (normal mode) else if (sscanf(buf, "set 0x%x 0x%x", &addr, &golden_val) == 2) _golden_write_reg(addr, 0xFFFFFFFF, golden_val); else if (sscanf(buf, "%63s", cmd) == 1) { // XXX: 63 = sizeof(cmd) - 1 if (!strcmp(cmd, "enable")) _golden_setting_enable(&_golden); else if (!strcmp(cmd, "disable")) _golden_setting_disable(&_golden); else if (!strcmp(cmd, "normal")) _golden_setting_set_mode(&_golden, MODE_NORMAL); else if (!strcmp(cmd, "compare")) _golden_setting_set_mode(&_golden, MODE_COMPARE); else if (!strcmp(cmd, "apply")) _golden_setting_set_mode(&_golden, MODE_APPLY); else if (!strcmp(cmd, "color")) _golden_setting_set_mode(&_golden, MODE_COLOR); else if (!strcmp(cmd, "diff")) _golden_setting_set_mode(&_golden, MODE_DIFF); else if (!strcmp(cmd, "filter")) _golden.func[0] = '\0'; } free_page((size_t)buf); EXIT_FUNC(FUNC_LV_BODY); return count; }
static int golden_test_proc_show(struct seq_file *m, void *v) { static int buf_golden_setting_idx = 0; // static off_t page_len = 0; // static off_t used_off = 0; // char *start_p; // int len = 0; int i = 0; ENTER_FUNC(FUNC_LV_BODY); if (1) { // (0 == off) { buf_golden_setting_idx = 0; // page_len = 0; // used_off = 0; } if (1) { // (0 == page_len) { if (FALSE == _golden.is_golden_log) { if (1) { // (0 == off) { for (i = 0; i < _golden.nr_golden_setting; i++) { seq_printf(m, ""HEX_FMT" "HEX_FMT" "HEX_FMT"\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, _golden.buf_golden_setting[i].golden_val ); } } } if (0 == _golden.nr_golden_setting) { if (1) { // (0 == off) { seq_printf(m, "\n********** golden_test help *********\n"); seq_printf(m, "1. disable snapshot: echo disable > /proc/clkmgr/golden_test\n"); seq_printf(m, "2. insert golden setting (tool mode): echo 0x10000000 (addr) 0bxxxx_xxxx_xxxx_xxxx_0001_0100_1001_0100 (mask & golden value) > /proc/clkmgr/golden_test\n"); seq_printf(m, "(2.) insert golden setting (hex mode): echo 0x10000000 (addr) 0xFFFF (mask) 0x1494 (golden value) > /proc/clkmgr/golden_test\n"); seq_printf(m, "(2.) insert golden setting (dec mode): echo 268435456 (addr) 65535 (mask) 5268 (golden value) > /proc/clkmgr/golden_test\n"); seq_printf(m, "3. set filter: echo filter func_name [line_num] > /proc/clkmgr/golden_test\n"); seq_printf(m, "(3.) disable filter: echo filter > /proc/clkmgr/golden_test\n"); seq_printf(m, "4. enable snapshot: echo enable > /proc/clkmgr/golden_test\n"); seq_printf(m, "5. set compare mode: echo compare > /proc/clkmgr/golden_test\n"); seq_printf(m, "(5.) set apply mode: echo apply > /proc/clkmgr/golden_test\n"); seq_printf(m, "(5.) set color mode: echo color > /proc/clkmgr/golden_test\n"); seq_printf(m, "(5.) set diff mode: echo color > /proc/clkmgr/golden_test\n"); seq_printf(m, "(5.) disable compare/apply/color mode: echo normal > /proc/clkmgr/golden_test\n"); seq_printf(m, "6. set register value (normal mode): echo set 0x10000000 (addr) 0x13201494 (reg val) > /proc/clkmgr/golden_test\n"); seq_printf(m, "(6.) set register value (mask mode): echo set 0x10000000 (addr) 0xffff (mask) 0x13201494 (reg val) > /proc/clkmgr/golden_test\n"); seq_printf(m, "(6.) set register value (bit mode): echo set 0x10000000 (addr) 0 (bit num) 1 (reg val) > /proc/clkmgr/golden_test\n"); } } else { static struct snapshot *snapshot; if (0 == 0 // off // buf_golden_setting_idx && !strcmp(_golden.func, __FUNCTION__) && (_golden.line == 0)) { snapshot_golden_setting(__FUNCTION__, 0); } while ((0 != buf_golden_setting_idx) || (NULL != (snapshot = _snapshot_consume(&_golden)))) { if (0 == buf_golden_setting_idx) { seq_printf(m, "// @ %s():%d\n", snapshot->func, snapshot->line); pr_debug("// @ %s():%d\n", snapshot->func, snapshot->line); } // start_p = p; for (i = buf_golden_setting_idx, buf_golden_setting_idx = 0; i < _golden.nr_golden_setting; i++) { // start_p = p; if (MODE_NORMAL == _golden.mode || ((_golden.buf_golden_setting[i].mask & _golden.buf_golden_setting[i].golden_val) != (_golden.buf_golden_setting[i].mask & snapshot->reg_val[i]) ) ) { if (MODE_COLOR == _golden.mode) { seq_printf(m, HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\t%s\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, snapshot->reg_val[i], _gen_color_str(_golden.buf_golden_setting[i].mask, _golden.buf_golden_setting[i].golden_val, snapshot->reg_val[i]) ); pr_debug(HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\t%s\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, snapshot->reg_val[i], _gen_color_str(_golden.buf_golden_setting[i].mask, _golden.buf_golden_setting[i].golden_val, snapshot->reg_val[i]) ); } else if (MODE_DIFF == _golden.mode) { seq_printf(m, HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\t%s\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, snapshot->reg_val[i], _gen_mask_str(_golden.buf_golden_setting[i].mask, snapshot->reg_val[i]) ); pr_debug(HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\t%s\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, snapshot->reg_val[i], _gen_mask_str(_golden.buf_golden_setting[i].mask, snapshot->reg_val[i]) ); seq_printf(m, HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\t%s\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, _golden.buf_golden_setting[i].golden_val, _gen_diff_str(_golden.buf_golden_setting[i].mask, _golden.buf_golden_setting[i].golden_val, snapshot->reg_val[i]) ); pr_debug(HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\t%s\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, _golden.buf_golden_setting[i].golden_val, _gen_diff_str(_golden.buf_golden_setting[i].mask, _golden.buf_golden_setting[i].golden_val, snapshot->reg_val[i]) ); } else seq_printf(m, HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, snapshot->reg_val[i]); pr_debug(HEX_FMT"\t"HEX_FMT"\t"HEX_FMT"\n", _golden.buf_golden_setting[i].addr, _golden.buf_golden_setting[i].mask, snapshot->reg_val[i]); } if (0) { // ((p - start_p) + (p - page) >= PAGE_SIZE) { buf_golden_setting_idx = i + 1; break; } } if (0) // ((p - start_p) + (p - page) >= PAGE_SIZE) break; } } // page_len = p - page; } else { // p = page + page_len; } #if 0 *start = page + (off - used_off); len = p - page; if (len > (off - used_off)) len -= (off - used_off); else { len = 0; used_off += page_len; page_len = 0; } *eof = (0 == buf_golden_setting_idx && 0 == len) ? 1 : 0; #endif EXIT_FUNC(FUNC_LV_BODY); return 0; // len < count ? len : count; }
Status_t Do_X(Cmd_Tbl_t *Cmd_Tbl, uint32 flag, uint32 argc, char *argv[]) { FuncIN(DO_X); if(argc > 0) { switch(*argv[0]) { case 's': // Down Down_Key_Callback(NULL); break; case 'w': // Up Up_Key_Callback(NULL); break; case 'a': // Left Left_Key_Callback(NULL); break; case 'd': // Right Right_Key_Callback(NULL); break; case '-': // Cancel Cancel_Key_Callback(NULL); break; case '+': // Enter Enter_Key_Callback(NULL); break; case '*': // Menu Menu_Key_Callback(NULL); break; case '/': // Exit Exit_Key_Callback(NULL); break; case '1': // Number 1 Num1_Key_Callback(NULL); break; case '2': // Number 2 Num2_Key_Callback(NULL); break; case '3': // Number 3 Num3_Key_Callback(NULL); break; case '4': // Number 4 Num4_Key_Callback(NULL); break; case '5': // Number 5 Num5_Key_Callback(NULL); break; case '6': // Number 6 Num6_Key_Callback(NULL); break; case '7': // Number 7 Num7_Key_Callback(NULL); break; case '8': // Number 8 Num8_Key_Callback(NULL); break; case '9': // Number 9 Num9_Key_Callback(NULL); break; case '0': // Number 0 Num0_Key_Callback(NULL); break; default: EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_X); } } else EXIT_FUNC(CMD_MISSING_ARGUMENT, DO_X); EXIT_SUCCESS_FUNC(DO_X); }
Status_t Update_Display_Panel(uint8 Mode) { FuncIN(UPDATE_DISPLAY_PANEL); HD44780_STRING_DEF *Row; switch(Mode) { case PULL: if(DisplaySync == 1) { if((ConsoleDisplayPrint == ENABLE) && (UpdateDisplay_State == 0)) Console_Display_Dump(); Row = (uint8 *)malloc(X_SIZE + 1); ASSERT(Row != 0, -HEAP_ALLOCATION_ERROR); switch(WorkingSurface) { case 1: Fill_Row(Row, SurfaceBuffer_1[UpdateDisplay_State]); break; case 2: Fill_Row(Row, SurfaceBuffer_2[UpdateDisplay_State]); break; } switch(UpdateDisplay_State) { case 0: if(HD44780_OK != HD44780_StrShow(0, 0, Row)) EXIT_FUNC(MENU_DISPLAY_ERROR, UPDATE_DISPLAY_PANEL); // Next State UpdateDisplay_State = 1; break; case 1: if(HD44780_OK != HD44780_StrShow(0, 1, Row)) EXIT_FUNC(MENU_DISPLAY_ERROR, UPDATE_DISPLAY_PANEL); // Next State #if Y_SIZE == 2 UpdateDisplay_State = 0; DisplaySync = 0; break; #else UpdateDisplay_State = 2; break; case 2: if(HD44780_OK != HD44780_StrShow(0, 2, Row)) EXIT_FUNC(MENU_DISPLAY_ERROR, UPDATE_DISPLAY_PANEL); // Next State UpdateDisplay_State = 3; break; case 3: if(HD44780_OK != HD44780_StrShow(0, 3, Row)) EXIT_FUNC(MENU_DISPLAY_ERROR, UPDATE_DISPLAY_PANEL); // Next State UpdateDisplay_State = 0; DisplaySync = 0; break; #endif default: UpdateDisplay_State = 0; DisplaySync = 0; break; } // switch(UpdateDisplay_State) free(Row); } // if(DisplaySync == 1) break; case FORCE: if(ConsoleDisplayPrint == ENABLE) Console_Display_Dump(); Row = (uint8 *)malloc(X_SIZE + 1); ASSERT(Row != 0, -HEAP_ALLOCATION_ERROR); for(uint32 i = 0; i < Y_SIZE; i++) { switch(WorkingSurface) { case 1: Fill_Row(Row, SurfaceBuffer_1[i]); break; case 2: Fill_Row(Row, SurfaceBuffer_2[i]); break; default: Fatal_Abort(-UNKNOWN_ERROR); } if(HD44780_OK != HD44780_StrShow(0, i, Row)) EXIT_FUNC(MENU_DISPLAY_ERROR, UPDATE_DISPLAY_PANEL); } // for(uint32 i = 0; i < Y_SIZE; i++) free(Row); break; default: Fatal_Abort(-INVALID_INPUT_PARAMETER); break; } // switch(Mode) EXIT_SUCCESS_FUNC(UPDATE_DISPLAY_PANEL); }
Status_t Do_Time_Alarm(Cmd_Tbl_t *Cmd_Tbl, uint32 flag, uint32 argc, char *argv[]) { FuncIN(DO_TIME_ALARM); int i; Status_t Status = GENERAL_ERROR; TimeAlarm_t TimeAlarm_s = {0}; char ArgumentTokens[12] = {0}; char *CommandString = NULL; uint8 Remove = FALSE; if(argc > 0) { for(i = 0; i < argc; i++) { /******** Try for 'date=' ********/ CommandString = strstr(argv[i], "date="); if(CommandString != NULL){ if(strlen(CommandString + 5) > 10) // Agument should be in format "DD.MM.YYYY" { printcmd(" # Invalid 'date' parameter!\n"); EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_TIME_ALARM); } strcpy(ArgumentTokens, CommandString + 5); // strtok is changing the string. We need local copy! ArgumentTokens[10] = '.'; // For strtok termination TimeAlarm_s.DateTime.Day = atoi(strtok(ArgumentTokens, ".")); // Take first token before first '.' and convert to integer TimeAlarm_s.DateTime.Month = atoi(strtok(NULL, ".")); // Take second token before second '.' and convert to integer TimeAlarm_s.DateTime.Year = atoi(strtok(NULL, ".")); // Take third token before third '.' and convert to integer } /******** Try for 'time=' ********/ CommandString = strstr(argv[i], "time="); if(CommandString != NULL){ if(strlen(CommandString + 5) > 8) // Agument should be in format "HH:MM:SS" { printcmd(" # Invalid 'time' parameter!\n"); EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_TIME_ALARM); } strcpy(ArgumentTokens, CommandString + 5); // strtok is changing the string. We need local copy! ArgumentTokens[8] = ':'; // For strtok termination TimeAlarm_s.DateTime.Hour = atoi(strtok(ArgumentTokens, ":")); // Take first token before first ':' and convert to integer TimeAlarm_s.DateTime.Minute = atoi(strtok(NULL, ":")); // Take second token before second ':' and convert to integer TimeAlarm_s.DateTime.Second = atoi(strtok(NULL, ":")); // Take third token before third ':' and convert to integer } /******** Try for 'state=' ********/ CommandString = strstr(argv[i], "state="); if(CommandString != NULL) { if(!strncmp("ON", CommandString + 6, 2)) TimeAlarm_s.State = ALARM_ON; else if(!strncmp("OFF", CommandString + 6, 3)) TimeAlarm_s.State = ALARM_OFF; else { printcmd(" # Invalid 'state' parameter!\n"); EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_TIME_ALARM); } } /******** Try for 'alarmID=' ********/ CommandString = strstr(argv[i], "alarmID="); if(CommandString != NULL) TimeAlarm_s.AlarmID = atoi(CommandString + 8); /******** Try for '-rm' ********/ CommandString = strstr(argv[i], "-rm"); if(CommandString != NULL) Remove = TRUE; /******** Try for 'repeat=' ********/ CommandString = strstr(argv[i], "repeat="); if(CommandString != NULL) TimeAlarm_s.Repeat = strtol(CommandString + 7, NULL, 2); /******** Try for 'response=' ********/ Status = Do_Try_Read_Time_Response_Cmd(argv[i], &TimeAlarm_s); VERIFY(Status, Status); switch(Status) { case CMD_INVALID_ARGUMENT: EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_TIME_ALARM); case SUCCESS: break; default: break; } // switch(Status) } // for(i = 0; i < argc; i++) if(Remove == FALSE) Do_Set_Time_Alarm_Cmd(&TimeAlarm_s); else Remove_Time_Alarm(TimeAlarm_s.AlarmID); } else { Time_Alarm_Status(NULL); } EXIT_SUCCESS_FUNC(DO_TIME_ALARM); }
Status_t Do_Sw(Cmd_Tbl_t *Cmd_Tbl, uint32 flag, uint32 argc, char *argv[]) { FuncIN(DO_SW); Out_t Out = {0}; char *CommandString; int i, SwUpdate = 0; if(argc > 0) { for(i = 0; i < argc; i++) { CommandString = strstr(argv[i], "sw1="); if(CommandString != NULL) { if(atoi(CommandString + 4)) Out_1_Set(NULL); else Out_1_Clr(NULL); SwUpdate = 1; } CommandString = strstr(argv[i], "sw2="); if(CommandString != NULL) { if(atoi(CommandString + 4)) Out_2_Set(NULL); else Out_2_Clr(NULL); SwUpdate = 1; } CommandString = strstr(argv[i], "sw3="); if(CommandString != NULL) { if(atoi(CommandString + 4)) Out_3_Set(NULL); else Out_3_Clr(NULL); SwUpdate = 1; } CommandString = strstr(argv[i], "sw4="); if(CommandString != NULL) { if(atoi(CommandString + 4)) Out_4_Set(NULL); else Out_4_Clr(NULL); SwUpdate = 1; } CommandString = strstr(argv[i], "sw5="); if(CommandString != NULL) { if(atoi(CommandString + 4)) Out_5_Set(NULL); else Out_5_Clr(NULL); SwUpdate = 1; } CommandString = strstr(argv[i], "sw6="); if(CommandString != NULL) { if(atoi(CommandString + 4)) Out_6_Set(NULL); else Out_6_Clr(NULL); SwUpdate = 1; } } // for(i = 0; i < argc; i++) if(SwUpdate == 0) EXIT_FUNC(CMD_INVALID_ARGUMENT, DO_SW); } else { Out_Get_State(OUTS_TO_SET, &Out); printcmd("\n # Out switches state:\n"); printcmd(" # Sw_1 = %u\n", Out.S_1); printcmd(" # Sw_2 = %u\n", Out.S_2); printcmd(" # Sw_3 = %u\n", Out.S_3); printcmd(" # Sw_4 = %u\n", Out.S_4); printcmd(" # Sw_5 = %u\n", Out.S_5); printcmd(" # Sw_6 = %u\n", Out.S_6); } EXIT_SUCCESS_FUNC(DO_SW); }