void isink_test(void) { unsigned int pre; unsigned int pulse; int mode; pre = 500; pulse = 1000; /* disable interrupts */ cm3_cpsid_i(); for (mode = 0; mode < 26; ++mode) { isink_io_cfg(mode); isink_pulse(pre, pulse); udelay(pulse + 500); } cm3_cpsie_i(); isink_drv.mode = -1; }
int cmd_isink(FILE * f, int argc, char ** argv) { unsigned int mode = 2; unsigned int rate = 1; unsigned int pre = 50; unsigned int pulse = 200; if (argc > 5) return SHELL_ERR_EXTRA_ARGS; if (argc > 1) { mode = strtoul(argv[1], NULL, 0); if (mode > 25) return SHELL_ERR_ARG_INVALID; if (argc > 2) { rate = strtoul(argv[2], NULL, 0); if (rate > 3) return SHELL_ERR_ARG_INVALID; if (argc > 3) { pulse = strtoul(argv[3], NULL, 0); if (argc > 4) pre = strtoul(argv[4], NULL, 0); } } } if (pulse < pre) pulse = pre; fprintf(f, "PW pulse: mode=%d rate=%d pulse=%dus pre=%dus ...\n", mode, rate, pulse, pre); isink_mode_set(mode | (rate << 5)); thinkos_sleep(2); isink_pulse(pre, pulse); return 0; }