Re: [Openocd-development] pointers modification within functions

2011-11-03 Thread Tomek CEDRO
Uhm, I have found a solution :-) The problem is that C (or GCC) can only change variable out of function using *variable=value construct. This *variable syntax is essential. This is the only possible way of using pointer to pass information outside function. But this way it is only possible to

Re: [Openocd-development] pointers modification within functions

2011-11-03 Thread Freddie Chopin
On 2011-11-03 17:38, Tomek CEDRO wrote: The problem is that C (or GCC) can only change variable out of function using *variable=value construct. That's how C works - everything is passed to the function by value, so when you pass a pointer, you just pass a value which is an address. 4\/3!!

Re: [Openocd-development] pointers modification within functions

2011-11-03 Thread Tomek CEDRO
Hmm, things seems to be more suble :-) I have tried a trick with using int *a; fun(int* a); and it indeed works but the address is trimmed no matter what type a is (int*, long*, void*) and this causes problems. 21 int a1=0, a2=0; (gdb) s 22 double *a3; (gdb) 23 a3=NULL; (gdb)

Re: [Openocd-development] pointers modification within functions

2011-11-03 Thread Tomek CEDRO
With current design of OpenOCD it is impossible to queue read operations as results are returned using single pointers, the read operation needs to be performed inside of a function that will return a result, otherwise we can only get a value given at queue time but not a flush time. LibSWD can

Re: [Openocd-development] pointers modification within functions

2011-11-03 Thread Tomek CEDRO
On Thu, Nov 3, 2011 at 10:43 PM, Tomek CEDRO tomek.ce...@gmail.com wrote: I have to perform execute queue on read operation. Luckily it only requires minor change of SWD_OPERATION_ENQUEUE into SWD_OPERATION_EXECUTE parameter :-P :-) -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

[Openocd-development] pointers modification within functions

2011-11-02 Thread Tomek CEDRO
Hey, I have some problems with pointers and need some support plz ;-) int swd_bus_read_ack(swd_ctx_t *swdctx, swd_operation_t operation, char **ack){ swd_cmd_enqueue_miso_ack(swdctx, ack); } int swd_cmd_enqueue_miso_ack(swd_ctx_t *swdctx, char **ack){ if (swdctx==NULL) return

Re: [Openocd-development] pointers modification within functions

2011-11-02 Thread Andreas Fritiofson
On Thu, Nov 3, 2011 at 12:41 AM, Tomek CEDRO tomek.ce...@gmail.com wrote: Hey, I have some problems with pointers and need some support plz ;-) I'm not sure I understand what the problem is, but I can give some general hints. int swd_bus_read_ack(swd_ctx_t *swdctx, swd_operation_t

Re: [Openocd-development] pointers modification within functions

2011-11-02 Thread Tomek CEDRO
Hello Andreas :-) On Thu, Nov 3, 2011 at 12:36 AM, Andreas Fritiofson andreas.fritiof...@gmail.com wrote: This won't even compile. You pass a pointer-to-int, but swd_bus_read_ack expects a pointer-to-pointer-to-char. naah this is only typo in mind-shortcut, code builds well, but i dont get it

Re: [Openocd-development] pointers modification within functions

2011-11-02 Thread Andreas Fritiofson
On Thu, Nov 3, 2011 at 1:43 AM, Tomek CEDRO tomek.ce...@gmail.com wrote: Hello Andreas :-) On Thu, Nov 3, 2011 at 12:36 AM, Andreas Fritiofson andreas.fritiof...@gmail.com wrote: This won't even compile. You pass a pointer-to-int, but swd_bus_read_ack expects a pointer-to-pointer-to-char.