From 22224bfd6f9969a09d659ba37fa17a5aa4389b8b Mon Sep 17 00:00:00 2001 From: Chris Esposito Date: Thu, 11 Jan 2018 18:11:28 +1100 Subject: [PATCH] AVRdebug() added; control transfers can cope with IN buffers --- Desktop_Interface/genericusbdriver.cpp | 2 ++ Matlab_Octave_API/C/USB_CONTROL_SEND_LIBUSB.c | 30 +++++++++++++++--- .../C/mex_outputs/USB_CONTROL_SEND_LIBUSB.mex | Bin 13576 -> 14720 bytes .../C/mex_outputs/USB_EXIT_LIBUSB.mex | Bin 12536 -> 12528 bytes .../C/mex_outputs/USB_INIT_LIBUSB.mex | Bin 18856 -> 18856 bytes Matlab_Octave_API/___main.m | 9 ++++-- .../labrador_send_debug_command.m | 18 +++++++++++ Matlab_Octave_API/octave-workspace | Bin 621 -> 585 bytes 8 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 Matlab_Octave_API/abstract_commands/labrador_send_debug_command.m diff --git a/Desktop_Interface/genericusbdriver.cpp b/Desktop_Interface/genericusbdriver.cpp index 4333175d..47980e82 100644 --- a/Desktop_Interface/genericusbdriver.cpp +++ b/Desktop_Interface/genericusbdriver.cpp @@ -307,6 +307,8 @@ void genericUsbDriver::setGain(double newGain){ void genericUsbDriver::avrDebug(void){ usbSendControl(0xc0, 0xa0, 0, 0, sizeof(unified_debug), NULL); + + qDebug() << "unified debug is of size" << sizeof(unified_debug); /* #ifndef PLATFORM_ANDROID unified_debug *udsPtr = (unified_debug *) inBuffer; diff --git a/Matlab_Octave_API/C/USB_CONTROL_SEND_LIBUSB.c b/Matlab_Octave_API/C/USB_CONTROL_SEND_LIBUSB.c index 80f187a7..ac1e24da 100644 --- a/Matlab_Octave_API/C/USB_CONTROL_SEND_LIBUSB.c +++ b/Matlab_Octave_API/C/USB_CONTROL_SEND_LIBUSB.c @@ -37,13 +37,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) uint16_t Value; uint16_t Index; uint16_t Length; - unsigned char *LDATA; //Interals unsigned char *controlBuffer; //To export: - unsigned char inBuffer[INPUT_BUFFER_SIZE]; + mwSize dims[2] = {1,INPUT_BUFFER_SIZE}; + unsigned char *out_ptr; //Parse Inputs HANDLE_CHAR_RAW_IN = mxArrayToString(prhs[0]); @@ -65,16 +65,36 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) sscanf(INDEX_RAW_IN, "%4x", &Index); LENGTH_RAW_IN = mxArrayToString(prhs[6]); - sscanf(LENGTH_RAW_IN, "%4x", &Length); + sscanf(LENGTH_RAW_IN, "%4x", &Length); + + //Allocate buffer memory if it's an IN transaction. Set it to an input pointer if it's an OUT. + if(Request & 0x80){ + controlBuffer = mxMalloc(INPUT_BUFFER_SIZE); + } else controlBuffer = mxGetData(prhs[7]); - controlBuffer = mxGetData(prhs[7]); //Send the packet int error; + mexPrintf("Length = %hu\n", Length); error = libusb_control_transfer(handle, RequestType, Request, Value, Index, controlBuffer, Length, 4000); if(error<0){ mexPrintf("Error number: %d\n", error); - mexPrintf("libusb_control_transfer FAILED with error %s", libusb_error_name(error)); + mexPrintf("libusb_control_transfer FAILED with error %s\n", libusb_error_name(error)); } + + plhs[0] = mxCreateNumericArray(2, dims, mxUINT8_CLASS, mxREAL); + + //Setup function output. + int n; + out_ptr = mxMalloc(INPUT_BUFFER_SIZE); + + //Copy data , even if it's not an IN transaction. + for (n=0;nO;5s54yOxHIxT4_v>m2Xx^RXmJ#B`zgM3P-VJQ(JspHyj1w4 zZposkfV#TEfH)Sgp+ISr;&)cb&sO-r5pTqI+axRQQ!(2SOLpg#-Fcue0a5m%s7rdv1H|#4FzCKe%_@mODQ2$nSpo2QNf#8|=a*&X?t@41>KSAClbH z@T@L^|Kk$)AD6&SE`i^%1YU-M7fUw?eII_-@FIX>`oCKO|LhVt^$#C@*6>3B#r$i) zeO6`g?MvX@FsKr%#7tGb)%6mu6|)wc`df98_PSQ-Tm59DzDJyOfk0?e{gC=gwWtua z>iv*Hdg%I8ED_gJ>0mO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04^#`PuedtV zjF#)E_5oL+&0+~r<2;KuG{FP7irVlLcvAuyAAi>ugJglum?w*U@Y+W)@a(d?lr)l@ z{GSe!4BD~`(>avhPPM`3*48w&*%yHJbfa$$8fLH}X6a*ZJchT#Z9@MLB0XgY0(Wqy zDaruhrW}r(3Y3)VIjrW=%_Sclb!LC;Ow^2yoQ;k2^qcz!;%2+mJ#6*HhRq{Ze9-Fd x>gb7E=b~MEA_rBKKbg+^6OMGeyw?LtEtw7QOnJgBu&j>ajHoG`^XhrH`X5vVm|6e; delta 816 zcmX|;T}TvB6vywGy|a7oWUD*7nYt!Rlpkr%N`zWa*#~6wp=Fy81Y>O~Su5^BPqktp z`CtS$L}(MChZG-D7R{jKHlNDMI%gIdm~;NW|M}0EudMyUeozSw zGgZ$Z@GZ04cJAf$?8<DwB4jyC@}f<}>iLHAxK9g^+j z{~}!}uaf>vIxL5<@;{^-^u1zW$dNGU(; zMi?;S$~McBjI1hnh}Nj#A=u@>xZx$Jc3{HTNB636VA|M0lUnG(Yvzm@0t@J+=8Z*) z)xkaVGK>%7-{2#n3(X>)qSuh?6nIRMNk3}I$9fQi^s0RS3GWuv?#A2)+F+{FUy(e5 z7Jlb1*zz4M-lNnwU&0-l;6ZE!#kdO0ae*3-zq!UBm8Uc2`+#{couxSNNheE_M#B65 zr+tLg4i@2b3ek+H%>l0lF10NXgw}LpU<&G=U_?yNV;AqlU1E}CNfSysWfcT(VIQQ? zJdiBSV#%stVVR!AXf}PI@T*ImEqPRDb;Yhnt!TVA7QftO9gW7XC1SnSNxP%Zz7p#T zHMKNbr=vGRr|d+J-9eaME$MfqyURL#Fsj~I^{}91_#k9eGuC!Bgmq564p;mGo_v;> diff --git a/Matlab_Octave_API/C/mex_outputs/USB_INIT_LIBUSB.mex b/Matlab_Octave_API/C/mex_outputs/USB_INIT_LIBUSB.mex index b764663f95e6e8b7e187e4ac659ba4f51992bf8e..8c97cc705471ab7aeebe3b461265bc8da77062c6 100755 GIT binary patch delta 901 zcmX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r0Emo6CTb@xmHmcn!=jWPZ_lmf6ldGYodiLZw7M(*U53)iDPIN_4FiA6a5=@ z{|nRiD^AJ=GvGdm6>!z-j5VWKvKzDDq7C#HlsuE;<_Y*F*UbP7rL%l3T23t{j1=9y zT*@Q<;$$~&=t5*OV&(&U5riLnU-8^Q7%M>3jAM(SFRI>)coIaP>BJd9UsBCkvL74`v~U*u~0dNHy|)50AF5u!@sS`eCth}H4r-&u_B3hEOBPQ>WCzUM`Lm8 zP`Gy_+!q`1w1qmY!;uS~uJC9y+)Fb3*?P;rf$H8}h0PNJK A?EnA( diff --git a/Matlab_Octave_API/___main.m b/Matlab_Octave_API/___main.m index fe66d3af..68322b5d 100644 --- a/Matlab_Octave_API/___main.m +++ b/Matlab_Octave_API/___main.m @@ -1,6 +1,8 @@ clear all clc +#https://docs.google.com/document/d/1ZDO1RTarQTNB6Pdfi_T4YukL51oYan_kk_teb1cu6-o/edit?usp=sharing + __addpaths; __load_globals; fflush(stdout); @@ -13,6 +15,10 @@ if(isequal(usb_handle, "0000000000000000")) return; end +fprintf("\nSending AVR Debug Command...\n"); +fflush(stdout); +labrador_send_debug_command(usb_handle, usb_context); + fprintf("\nSetting Device Mode to 2 (Scope CH1 and CH2) with gain 8...\n"); fflush(stdout); labrador_set_device_mode(usb_handle, usb_context, 2, 8); @@ -35,5 +41,4 @@ labrador_set_psu_voltage(usb_handle, usb_context, 8.8); fprintf("\nExiting Libusb...\n"); fflush(stdout); -mex_usb_exit(usb_handle, usb_context); - \ No newline at end of file +mex_usb_exit(usb_handle, usb_context); \ No newline at end of file diff --git a/Matlab_Octave_API/abstract_commands/labrador_send_debug_command.m b/Matlab_Octave_API/abstract_commands/labrador_send_debug_command.m new file mode 100644 index 00000000..9faa6f33 --- /dev/null +++ b/Matlab_Octave_API/abstract_commands/labrador_send_debug_command.m @@ -0,0 +1,18 @@ +function [] = labrador_send_debug_command(usb_handle, usb_context); + + SIZE_OF_UNIFIED_DEBUG = 27; + + USB_Control_IN_data = mex_usb_send_control(usb_handle, usb_context, 'c0', 'a0', '0', '0', dec2hex(SIZE_OF_UNIFIED_DEBUG), []); + + USB_Control_IN_data + + debugtext = char(USB_Control_IN_data(1:9)) ; + trfcnt0 = uint16(USB_Control_IN_data(10)) + 255 * uint16(USB_Control_IN_data(11)); + trfcnt1 = uint16(USB_Control_IN_data(12)) + 255 * uint16(USB_Control_IN_data(13)); + medianTrfcnt = uint16(USB_Control_IN_data(14)) + 255 * uint16(USB_Control_IN_data(15)); + outOfRange = uint16(USB_Control_IN_data(16)) + 255 * uint16(USB_Control_IN_data(17)); + counter = uint16(USB_Control_IN_data(18)) + 255 * uint16(USB_Control_IN_data(19)); + dma_ch0_cnt = uint16(USB_Control_IN_data(20)) + 255 * uint16(USB_Control_IN_data(21)); + dma_ch1_cnt = uint16(USB_Control_IN_data(22)) + 255 * uint16(USB_Control_IN_data(23)); + + fprintf("debugtext = %s\ntrfcnt0 = %d\ntrfcnt1 = %d\nmedianTrfcnt = %d\noutOfRange = %d\ncounter = %d\ndma_ch0_cnt = %d\ndma_ch1_cnt = %d\n",debugtext, trfcnt0, trfcnt1, medianTrfcnt, outOfRange, counter, dma_ch0_cnt, dma_ch1_cnt); diff --git a/Matlab_Octave_API/octave-workspace b/Matlab_Octave_API/octave-workspace index e6075d3045d8d9c0438216c59f5082f7ff963a9b..f4f2cbf3c5524b775ce2bd52e6ddb387e2411983 100644 GIT binary patch delta 78 zcmaFMa*}1kF-9jg1_p-Q#FC=SihuwA{|9owfSn6Sl@=$(XC&sO(f|Me delta 125 zcmX@f@|I=8F~(d@1_p-W!uaBnqRhPXfB*mgX9Nle0I>lSq$QggTbd;rZ~?_ii<9Cr k67y1WQh^)>hX2H9HZ->|Hed#-E=x|HY``QwS&c~<08wlr$^ZZW