FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  


Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support

New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: USER_CONTEXT and PUSER_CONTEXT types missing for use of callback notification  (Read 2890 times)


  • Newbie
  • *
  • Posts: 3
    • View Profile

Hi all,

I'd like to use the callback notification provided by the D3xx driver. According to the AN_379 programmers guide example starting at page 61, there is a definition:

Code: [Select]
USER_CONTEXT UserContext = {0};
on page 67. This seems to be a structure containing the ftHandle and other fields since later on the page there is:

Code: [Select]
UserContext.m_ftHandle = ftHandle;
ftStatus = FT_SetNotificationCallback(ftHandle, NotificationCallback, &UserContext);

Further down on page 68 a pointer type of it PUSER_CONTEXT is used to cast the void pointer from the callback function and access the fields:

Code: [Select]
PUSER_CONTEXT pUserContext = (PUSER_CONTEXT)pvCallbackContext;
ULONG ulBytesTransferred = 0;
DEBUG(_T("\n\tReading %d bytes!\n"), pInfo->ulRecvNotificationLength);
FT_STATUS ftStatus = FT_ReadPipe( pUserContext->m_ftHandle, pInfo->ucEndpointNo, &pUserContext->m_ucRecvBuffer[pUserContext->m_ulCurrentRecvData], pInfo->ulRecvNotificationLength, &ulBytesTransferred, NULL );

The field name m_ftHandle sugests that this context structure is an FTDI defined type but I can not find this definition eg. in  FTD3XX.h or so. Anybody here who has seen this type beeing defined somewhere?

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 866
    • View Profile


You are already in contact with our support team on this issue via email.
Please post any resolution here to help other customers.

Best Regards,
FTDI Community


  • Newbie
  • *
  • Posts: 3
    • View Profile

Well, yes, thanks for the support reply. I'd like to post it herewith:

> The field USER_CONTEXT is purely application-defined and the customer is free to define as per the application requirement.
> In our example, we needed the context to ftHandle hence we have a pointer to ftHandle within the context.
> However this does not mean that the structure is ftdi defined.
So, to me it answers the question so far that there are no other fields from this structure used beside the visible names. So, I can define the structure based on the missing names from the example.

However, I found another example for the callback notification in the package FT600APIUsageDemoApp_v1.3.0.4.
The source FTD3XX_NotificationData.cpp has a definition for the context using a different approach:

Code: [Select]
typedef struct _USER_CONTEXT
    CRITICAL_SECTION                    m_hCriticalSection;
    HANDLE                              m_hEventDataAvailable;


May be it works best to create the own software based on the example in  FT600APIUsageDemoApp_v1.3.0.4 instead og the App note code.