For example, when trying to obtain a buffer via
apiRetStatus = CyU3PDmaChannelGetBuffer (&MIDI_IN_HANDLE, &buf_p, CYU3P_WAIT_FOREVER);
apiRetStatus is set to 64. By numbering the error codes in the error enum in the api's error.h, 64 means CY_U3P_ERROR_INVALID_DEV. Well that doesn't make much sense, but it does seem that certain functions have different sets of errors associated with them.
How can I best decode errors such as these?
You can find the error code definitions in cyu3error.h
I suppose the 64 value returned is in decimal (not in hex), please check the debug print function whether it prints %d or %x in your case. 64 in decimal is 0x40 in hex which corresponds to "CY_U3P_ERROR_BAD_ARGUMENT" /**< One or more parameters to a function are invalid. */