unsigned char FIFO_PullFromBuff(CANFIFO *Buff, CANMesStruc *CANMsg) { if (!FIFO_isEmpty(Buff)) { *CANMsg = Buff->Buff[Buff->tail++]; Buff->tail%=FIFO_LEN; return 1; } return 0; }
static void at_fifo_check(void *arg) { static uint8_t wait_response_tick = 0; if(s_module_status == MODULE_START) { send_at_command("AT\r\n"); } else if(MODULE_INIT ==s_module_status|| MODULE_INIT_DONE == s_module_status) { if ((NULL == s_current_at_command)) { if ((!FIFO_isEmpty(&s_at_fifo)) &&(s_at_status == ATC_RSP_FINISH)) { s_current_at_command = (struct at_cmd_entity*)mymalloc(sizeof(struct at_cmd_entity)); if (FIFO_Get(&s_at_fifo, s_current_at_command->at_name, s_current_at_command->at_cmd)) { s_at_status = ATC_RSP_WAIT; send_at_command(s_current_at_command->at_cmd); } } else { printf("fifo is empty or the previous at command not complete!\n"); } } else { printf("the at command is in sending!\n"); if(wait_response_tick > AT_MAX_RESPONSE_TIME) { printf("the at command sending is timeout!\n"); } wait_response_tick++; } } }