static INT32 _stp_btm_put_dump_to_nl(VOID) { #define NUM_FETCH_ENTRY 8 static UINT8 buf[2048]; static UINT8 tmp[2048]; UINT32 buf_len; STP_PACKET_T *pkt; STP_DBG_HDR_T *hdr; INT32 remain = 0, index = 0; INT32 retry = 0, rc = 0; INT32 len; STP_BTM_INFO_FUNC("Enter..\n"); index = 0; tmp[index++] = '['; tmp[index++] = 'M'; tmp[index++] = ']'; do { index = 3; remain = stp_dbg_dmp_out_ex(&buf[0], &buf_len); if (buf_len > 0) { pkt = (STP_PACKET_T *) buf; hdr = &pkt->hdr; len = pkt->hdr.len; osal_memcpy(&tmp[index], &len, 2); index += 2; if (hdr->dbg_type == STP_DBG_FW_DMP) { osal_memcpy(&tmp[index], pkt->raw, pkt->hdr.len); if (pkt->hdr.len <= 1500) { tmp[index + pkt->hdr.len] = '\n'; tmp[index + pkt->hdr.len + 1] = '\0'; /* pr_warn("\n%s\n+++\n", tmp); */ rc = stp_btm_dump_send_retry_handler((PINT8)&tmp, len); if (rc) goto exit; /* schedule(); */ } else { STP_BTM_INFO_FUNC("dump entry length is over long\n"); osal_bug_on(0); } retry = 0; } } else { retry++; osal_sleep_ms(100); } } while ((remain > 0) || (retry < 2)); exit: STP_BTM_INFO_FUNC("Exit..\n"); return 0; }
static INT32 _stp_btm_put_dump_to_aee(void) { static UINT8 buf[2048]; static UINT8 tmp[2048]; UINT32 buf_len; STP_PACKET_T *pkt; STP_DBG_HDR_T *hdr; INT32 remain = 0; INT32 retry = 0; INT32 ret = 0; STP_BTM_INFO_FUNC("Enter..\n"); do { remain = stp_dbg_dmp_out_ex(&buf[0], &buf_len); if (buf_len > 0) { pkt = (STP_PACKET_T*)buf; hdr = &pkt->hdr; if (hdr->dbg_type == STP_DBG_FW_DMP) { osal_memcpy(&tmp[0], pkt->raw, pkt->hdr.len); if (pkt->hdr.len <= 1500) { tmp[pkt->hdr.len] = '\n'; tmp[pkt->hdr.len + 1] = '\0'; ret = stp_dbg_aee_send(tmp, pkt->hdr.len, 0); } else { STP_BTM_INFO_FUNC("dump entry length is over long\n"); osal_bug_on(0); } retry = 0; } retry = 0; } else { retry ++; osal_sleep_ms(20); } }while ((remain > 0) || (retry < 10)); STP_BTM_INFO_FUNC("Exit..\n"); return ret; }
static INT32 _stp_btm_put_dump_to_nl(void) { #define NUM_FETCH_ENTRY 8 static UINT8 buf[2048]; static UINT8 tmp[2048]; UINT32 buf_len; STP_PACKET_T *pkt; STP_DBG_HDR_T *hdr; INT32 remain=0, index =0; INT32 retry = 0, rc = 0, nl_retry = 0; STP_BTM_INFO_FUNC("Enter..\n"); index = 0; tmp[index++]='['; tmp[index++]='M'; tmp[index++]=']'; do { index = 3; remain = stp_dbg_dmp_out_ex(&buf[0], &buf_len); if (buf_len > 0) { pkt = (STP_PACKET_T *)buf; hdr = &pkt->hdr; if (hdr->dbg_type == STP_DBG_FW_DMP){ memcpy(&tmp[index], pkt->raw, pkt->hdr.len); if(pkt->hdr.len <= 1500) { tmp[index + pkt->hdr.len] = '\n'; tmp[index + pkt->hdr.len + 1] = '\0'; //printk("\n%s\n+++\n", tmp); rc = stp_dbg_nl_send((char *)&tmp, 2); while(rc){ nl_retry++; if(nl_retry > 1000){ break; } STP_BTM_WARN_FUNC("**dump send fails, and retry again.**\n"); msleep(3); rc = stp_dbg_nl_send((char *)&tmp, 2); if(!rc){ STP_BTM_WARN_FUNC("****retry again ok!**\n"); } } //schedule(); } else { STP_BTM_INFO_FUNC("dump entry length is over long\n"); BUG_ON(0); } retry = 0; } }else { retry ++; msleep(100); } }while((remain > 0) || (retry < 2)); STP_BTM_INFO_FUNC("Exit..\n"); return 0; }