typedef struct
{
char *str; // 명령어
int (*func)(int, char **); // 명령어 서버루틴
char *usage; // 사용법
} Cmd_tbl;
const Cmd_tbl cmd_ctbl[] = {
{"help", monitor_chelp, "monitor help"},
{"ls", monitor_lshelp, "Command List"},
{0,0,0}
};
"help" : 입력시 받아들일 명령어
monitor_chelp : 명령어가 일치할 경우 처리할 서버루틴
"monitor help" : 사용법에 대한 정의
새로운 명령어 추가시
int NameRoutine(int argc, char* argv[])
{
argc // 명령어 개수
argv[1] // 입력 String 주소
코딩
return YES;
}
1) Queue가 비어있는지 확인
2) Insert Queue (큐에 입력)
void Uart3_EnQueue(uint16_t data)
{
u3_rx_buffer[u3_rx_point_head] = data;
y3_increase_point_value(&u3_rx_point_head);
}
3) Delete Queue (큐에서 빼내기)
uint16_t Uart3_DeQueue(void)
{
uint16_t retVal = u3_rx_buffer[u3_rx_point_tail];
u3_increase_point_value(&u3_rx_point_tail);
return retVal;
}