Lines Matching refs:shellCB
50 CHAR *ShellGetInputBuf(ShellCB *shellCB)
52 CmdKeyLink *cmdkey = shellCB->cmdKeyLink;
55 (VOID)pthread_mutex_lock(&shellCB->keyMutex);
57 (VOID)pthread_mutex_unlock(&shellCB->keyMutex);
63 (VOID)pthread_mutex_unlock(&shellCB->keyMutex);
68 STATIC VOID ShellSaveHistoryCmd(const CHAR *string, ShellCB *shellCB)
70 CmdKeyLink *cmdHistory = shellCB->cmdHistoryKeyLink;
78 (VOID)pthread_mutex_lock(&shellCB->historyMutex);
83 (VOID)pthread_mutex_unlock(&shellCB->historyMutex);
93 (VOID)pthread_mutex_unlock(&shellCB->historyMutex);
100 (VOID)pthread_mutex_unlock(&shellCB->historyMutex);
104 STATIC VOID ShellNotify(ShellCB *shellCB)
106 (VOID)LOS_EventWrite(&shellCB->shellEvent, SHELL_CMD_PARSE_EVENT);
115 STATIC INT32 ShellCmdLineCheckUDRL(const CHAR ch, ShellCB *shellCB)
119 shellCB->shellKeyType = STAT_ESC_KEY;
122 if (shellCB->shellKeyType == STAT_ESC_KEY) {
123 shellCB->shellKeyType = STAT_MULTI_KEY;
127 if (shellCB->shellKeyType == STAT_MULTI_KEY) {
128 OsShellHistoryShow(CMD_KEY_UP, shellCB);
129 shellCB->shellKeyType = STAT_NORMAL_KEY;
133 if (shellCB->shellKeyType == STAT_MULTI_KEY) {
134 shellCB->shellKeyType = STAT_NORMAL_KEY;
135 OsShellHistoryShow(CMD_KEY_DOWN, shellCB);
139 if (shellCB->shellKeyType == STAT_MULTI_KEY) {
140 shellCB->shellKeyType = STAT_NORMAL_KEY;
144 if (shellCB->shellKeyType == STAT_MULTI_KEY) {
145 shellCB->shellKeyType = STAT_NORMAL_KEY;
152 LITE_OS_SEC_TEXT_MINOR VOID ShellCmdLineParse(CHAR c, pf_OUTPUT outputFunc, ShellCB *shellCB)
157 if ((shellCB->shellBufOffset == 0) && (ch != '\n') && (ch != '\0')) {
158 (VOID)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
162 if (shellCB->shellBufOffset < (SHOW_MAX_LEN - 1)) {
163 shellCB->shellBuf[shellCB->shellBufOffset] = '\0';
165 shellCB->shellBufOffset = 0;
166 (VOID)pthread_mutex_lock(&shellCB->keyMutex);
167 OsShellCmdPush(shellCB->shellBuf, shellCB->cmdKeyLink);
168 (VOID)pthread_mutex_unlock(&shellCB->keyMutex);
169 ShellNotify(shellCB);
172 if ((shellCB->shellBufOffset > 0) && (shellCB->shellBufOffset < (SHOW_MAX_LEN - 1))) {
173 shellCB->shellBuf[shellCB->shellBufOffset - 1] = '\0';
174 shellCB->shellBufOffset--;
179 if ((shellCB->shellBufOffset > 0) && (shellCB->shellBufOffset < (SHOW_MAX_LEN - 1))) {
180 ret = OsTabCompletion(shellCB->shellBuf, &shellCB->shellBufOffset);
182 outputFunc("OHOS # %s", shellCB->shellBuf);
188 ret = ShellCmdLineCheckUDRL(ch, shellCB);
194 if (shellCB->shellBufOffset < (SHOW_MAX_LEN - 1)) {
195 shellCB->shellBuf[shellCB->shellBufOffset] = ch;
197 shellCB->shellBuf[SHOW_MAX_LEN - 1] = '\0';
199 shellCB->shellBufOffset++;
203 shellCB->shellKeyType = STAT_NORMAL_KEY;
333 ShellCB *shellCB = (ShellCB *)param;
335 CONSOLE_CB *consoleCB = OsGetConsoleByID((INT32)shellCB->consoleID);
341 (VOID)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
350 ShellCmdLineParse(ch, (pf_OUTPUT)dprintf, shellCB);
362 STATIC VOID ShellCmdProcess(ShellCB *shellCB)
366 buf = ShellGetInputBuf(shellCB);
371 ShellSaveHistoryCmd(buf, shellCB);
372 shellCB->cmdMaskKeyLink = shellCB->cmdHistoryKeyLink;
382 ShellCB *shellCB = (ShellCB *)param1;
389 ret = LOS_EventRead(&shellCB->shellEvent,
392 ShellCmdProcess(shellCB);
397 OsShellKeyDeInit((CmdKeyLink *)shellCB->cmdKeyLink);
398 OsShellKeyDeInit((CmdKeyLink *)shellCB->cmdHistoryKeyLink);
399 (VOID)LOS_EventDestroy(&shellCB->shellEvent);
400 (VOID)LOS_MemFree((VOID *)m_aucSysMem0, shellCB);
409 LITE_OS_SEC_TEXT_MINOR UINT32 ShellTaskInit(ShellCB *shellCB)
414 if (shellCB->consoleID == CONSOLE_SERIAL) {
416 } else if (shellCB->consoleID == CONSOLE_TELNET) {
424 initParam.auwArgs[0] = (UINTPTR)shellCB;
429 (VOID)LOS_EventInit(&shellCB->shellEvent);
431 return LOS_TaskCreate(&shellCB->shellTaskHandle, &initParam);
434 LITE_OS_SEC_TEXT_MINOR UINT32 ShellEntryInit(ShellCB *shellCB)
440 if (shellCB->consoleID == CONSOLE_SERIAL) {
442 } else if (shellCB->consoleID == CONSOLE_TELNET) {
450 initParam.auwArgs[0] = (UINTPTR)shellCB;
455 ret = LOS_TaskCreate(&shellCB->shellEntryHandle, &initParam);
457 (VOID)ConsoleTaskReg((INT32)shellCB->consoleID, shellCB->shellEntryHandle);