Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8733647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:41:35+00:00 2026-06-13T09:41:35+00:00

Ok let me explain a little more. I have a pointer to structure AB

  • 0

Ok let me explain a little more. I have a pointer to structure AB type struct1 inside the structure there is a pointer to another structure called CD of type struct2 and the definition of struct2 have some prototypes for functions including Func(param). If someone can help me understand a little I will be very thankfull.


Yes, the code is for a USB host in a microcontroller I didn’t add the code because it could drive the question away, but here it is,

The call is:

void USBHOST_Process(USB_OTG_CORE_HANDLE *pdev , USBH_HOST *phost){
    ...
    if (phost->usr_cb->UserInput() == USBH_USR_RESP_OK){
    ...
    }
    ...
}


typedef struct _Host_TypeDef
{
  HOST_State            gState;       /*  Host State Machine Value */
  HOST_State            gStateBkp;    /* backup of previous State machine value */
  ENUM_State            EnumState;    /* Enumeration state Machine */
  CMD_State             RequestState;       
  USBH_Ctrl_TypeDef     Control;

  USBH_Device_TypeDef   device_prop; 

  USBH_Class_cb_TypeDef               *class_cb;  
  USBH_Usr_cb_TypeDef                 *usr_cb;


} USBH_HOST, *pUSBH_HOST;


typedef struct _USBH_USR_PROP
{
  void (*Init)(void);       /* HostLibInitialized */
  void (*DeInit)(void);       /* HostLibInitialized */  
  void (*DeviceAttached)(void);           /* DeviceAttached */
  void (*ResetDevice)(void);
  void (*DeviceDisconnected)(void); 
  void (*OverCurrentDetected)(void);  
  void (*DeviceSpeedDetected)(uint8_t DeviceSpeed);          /* DeviceSpeed */
  void (*DeviceDescAvailable)(void *);    /* DeviceDescriptor is available */
  void (*DeviceAddressAssigned)(void);  /* Address is assigned to USB Device */
  void (*ConfigurationDescAvailable)(USBH_CfgDesc_TypeDef *,
                                     USBH_InterfaceDesc_TypeDef *,
                                     USBH_EpDesc_TypeDef *); 
  /* Configuration Descriptor available */
  void (*ManufacturerString)(void *);     /* ManufacturerString*/
  void (*ProductString)(void *);          /* ProductString*/
  void (*SerialNumString)(void *);        /* SerialNubString*/
  void (*EnumerationDone)(void);           /* Enumeration finished */
  USBH_USR_Status (*UserInput)(void);
  int  (*UserApplication) (void);
  void (*DeviceNotSupported)(void); /* Device is not supported*/
  void (*UnrecoveredError)(void);

}
USBH_Usr_cb_TypeDef;

Now I understand what it does, but I can’t find the definition of UserInput(void) I can’t find what it does.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:41:37+00:00Added an answer on June 13, 2026 at 9:41 am

    What you call “some prototypes for functions including Func(param)” is a function pointer. You can invoke a function pointed to by the pointer as if the pointer represented that function’s name. The inner-most structure has been set up with a pointer to some function; your code snippet invokes that function through its pointer.

    Here is a short example that illustrates how this works (also on ideone):

    #include <stdio.h>
    
    typedef struct {
        void (*func)(int);  
    } with_fp;
    
    void test(int n) {
        printf("Test %d\n", n);
    }
    
    int main(void) {
        with_fp s = {.func = test};
        with_fp *ptr = &s;
        ptr->func(123);
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the title might be a little bit confusing, let me explain, ;) I have
Let me explain you my situation. I have a base class called Shape, and
I have been doing some reading and a little bit confused, let me explain.
I'm doing a navigation based application. Let me explain a little bit about the
Let me explain best with an example. Say you have node class that can
let me explain my current situation i have a SharePoint site lets say it
Let me explain what I mean : Let's say we have a menu with
So let me explain my problem a little better now (please reopen this question).
Okay so my title might be a little confusing, but let me explain my
Let me provide a little detail to explain what I'm trying to accomplish before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.