#include "calibration_detect.h"
#include <stdbool.h>
+#include <malloc.h>
static unsigned int nv_buffer[256]={0};
static int s_is_calibration_mode = 0;
unsigned char sub_cmd;
} COMMAND_T;
+extern int get_mode_from_gpio(void);
+extern int do_fs_file_read(char *mpart, char *filenm, void *buf, int len);
extern int serial_tstc(void);
static unsigned long long start_time;
static unsigned long long now_time;
-static caliberate_device = CALIBERATE_DEVICE_NULL;
+static int caliberate_device = CALIBERATE_DEVICE_NULL;
static void send_caliberation_request(void)
{
int pctool_mode_detect_uart(void)
{
- int ret;
int i ;
unsigned int caliberate_mode;
uint8_t buf[20];
int got = 0;
printf("%s\n", "uart calibrate detecting");
- loff_t off = 0;
send_caliberation_request();
#ifdef CONFIG_MODEM_CALIBERATE
buf[i] = i + 'a';
start_time = get_timer_masked();
- printf("uart calibrate configuration start_time=%d\n", start_time);
+ printf("uart calibrate configuration start_time=%llu\n", start_time);
while (1) {
got = receive_caliberation_response(buf, sizeof(buf));
if (caliberate_device == CALIBERATE_DEVICE_UART)
return command;
}
-extern int power_button_pressed(void);
static int count_ms;
static unsigned long long start_time;
static unsigned long long now_time;
+#if 0
+extern int power_button_pressed(void);
static int recheck_power_button(void)
{
int cnt = 0;
}
}while(1);
}
+#endif
+
int is_timeout(void)
{
if(usb_trans_status)
printf("func: %s line %d usb trans with error %d\n", __func__, __LINE__, usb_trans_status);
ret = gs_read(buf, &count);
- printf("func: %s readly read %d\n", __func__, count);
+ printf("func: %s readly read %d ret(%d)\n", __func__, count, ret);
if(usb_trans_status)
printf("func: %s line %d usb trans with error %d\n", __func__, __LINE__, usb_trans_status);
for(i = 0; i<count; i++)
#endif
}
-int cali_usb_prepare()
+int cali_usb_prepare(void)
{
- int ret = 0;
usb_in_cal(1);
if(dwc_otg_driver_init() < 0)
{
}
return 1;
}
-int cali_usb_enum()
+int cali_usb_enum(void)
{
int ret = 0;
count_ms = get_cal_enum_ms();
int prepare_reply_buf(uint8_t* buf, int status)
{
- int ret = 0;
char *rsp_ptr;
MSG_HEAD_T* msg_head_ptr;
TOOLS_DIAG_AP_CNF_T* aprsp;
aprsp->status = status;
aprsp->length = CALIBERATE_CNF_LEN;
- total_len = translate_packet((unsigned char*)pctool_cnf_buf,(unsigned char*)rsp_ptr,((MSG_HEAD_T*)rsp_ptr)->len);
+ total_len = translate_packet((char*)pctool_cnf_buf,(char*)rsp_ptr,((MSG_HEAD_T*)rsp_ptr)->len);
free(rsp_ptr);
return total_len;
}
{
int ret , command;
- unsigned int caliberate_mode;
- loff_t off = 0;
+
printf("%s\n", "uart cooperating with pc tool");
if(get_mode_from_gpio())
return pctool_mode_detect_uart();