This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC3131 usb mem example

I have the lpc3131 embedded artists board and I am working on a USB driver. I first converted the Keil example code to IAR code and got the USB working. I then tried to port it over to a different syntax and for some reason the following code does not reset the ep_QH (end point queue head) to make dQH (device queue head) values zero:

DQH_T* const ep_QH = (DQH_T*)DQH_BASE;

//memset fills the first n bytes of the memory area //pointed to by s with the constant byte c.
//void *memset(void *s, int c, size_t n);

/* Zero out the Endpoint queue heads */
memset((void*)ep_QH, 0, EP_NUM_MAX * sizeof(DQH_T));

/* dQH Queue Head */
typedef volatile struct
{ Int32U cap;
Int32U curr_dTD;
Int32U next_dTD;
Int32U total_bytes;
Int32U buffer0;
Int32U buffer1;
Int32U buffer2;
Int32U buffer3;
Int32U buffer4;
Int32U reserved;
Int32U setup[2];
Int32U gap[4];
} DQH_T;

//Here's the memset function:
#define _DLIB_STRING_SKIP_INLINE_MEMSET
#pragma inline
void * memset(void * _D, int _C, size_t _N)
{ __aeabi_memset(_D, _N, _C);
return _D;
}

It goes into the function and passes the correct parameters but it doesn't seem to change the value of dQH to zero. Anyone know why this is happening or a work around.

Parents
  • My head hurts a bit when I see parameters named _D, _C and _N. Why not give the parameters real names?

    Note that code is way easier to read if you tag it as code. See the posting instructions directly above the message input box.

Reply
  • My head hurts a bit when I see parameters named _D, _C and _N. Why not give the parameters real names?

    Note that code is way easier to read if you tag it as code. See the posting instructions directly above the message input box.

Children