Cart Contact NSDSP Home

nsdsp_debug_check_for_data

This function returns the amount of data received from NSDSP programmer and ready to be fetched.

Syntax

int nsdsp_debug_check_for_data(
        nsdsp_session_t   session
);

Parameters

session - a reference to the Debug Session Object obtained with nsdsp_session_program_for_debug or nsdsp_start_debug_session function

Return

The function returns the amount of available data in bytes.

Notes

This example for dsPIC33 reads breakpoints state, three registers, and stack return address. While the request is processed, the example uses nsdsp_debug_check_for_data function to check for completion in a loop.

  // Build the request
  Outstanding = 0;
  Outstanding += nsdsp_debug_read_bp_state(sess);
  Outstanding += nsdsp_debug_read_reg(sess,REG_PIC24_W0);
  Outstanding += nsdsp_debug_read_reg(sess,REG_PIC24_W1);
  Outstanding += nsdsp_debug_read_reg(sess,REG_PIC24_W2);
  Outstanding += nsdsp_debug_read_stack(sess,0);
  Outstanding += nsdsp_debug_read_stack(sess,1);

  // Transfer the request
  nsdsp_session_flush(sess);

  while (nsdsp_debug_check_for_data(sess) < Outstanding) {
    // Do something while waiting
  }

  // Fetch the data in the same order as in the request
  BPState = nsdsp_debug_fetch_bp_state(sess);
  W0 = nsdsp_debug_fetch_word(sess);
  W1 = nsdsp_debug_fetch_word(sess);
  W2 = nsdsp_debug_fetch_word(sess);
  // Get RetAddr in two lines to ensure correct fetching order
  RetAddr = nsdsp_debug_fetch_stack(sess) << 16;
  RetAddr |= (nsdsp_debug_fetch_stack(sess) & 0xfffe);

This function is different from nsdsp_session_check_for_data. Do not use nsdsp_session_check_for_data when debugging.

 

Minimum library version - 163

Northern Software Home NSDSP Contact Us Purchase/View Cart

© 2007-2025 Northern Software Inc. All Rights Reserved.