How to integrate interrupts into own drivers

Hello!

 

I have asked this question in an old topic, but since I've got no answer, i'll try to reach more specialists.

 

I'm currently struggling with my SMbus driver. Could someone please install this driver (it's based on the r_riic driver and still under construction) and try to build a new project with it?

If I use an empty project and try to build with the SMBus driver (Driver->Connectivity->SMBus Master on riic) added, then I get this message:

 

I have no idea where thouse names of interrupts are coming from... I have expected something like "smb_counter_overflow_isr" and so on.

 

Here are the files.

Synergy.r_smb.1.4.2.zip

 Just install like every othe drivers, i.e. download, rename to .pack and copy into the installation folder (example: C:\Renesas\e2_studio\internal\projectgen\arm\Packs).

I will be very gratefull for any hint. I would like to understand how to write own drivers for my projects.

 

Regards,

Gregor

  • I don't get the error you are seeing, I get :-

    However, the symbols you are seeing are probably generated by the XML for a driver, since they are in src\synergy_gen\new_thread.o.

  • In reply to Jeremy:

    Hello Jeremy,

     

    this is a very strange phenomena....

     

    In the XML file you can find the following declaration:

            <declarations>
                #if !defined(SSP_SUPPRESS_ISR_${module.driver.r_smb_master.name}) &amp;&amp; !defined(SSP_SUPPRESS_ISR_IIC${module.driver.r_smb_master.channel})
                    SSP_VECTOR_DEFINE_CHAN(smb_receive_data_full_isr, IIC, RXI, ${module.driver.r_smb_master.channel});
                #endif
                
                #if !defined(SSP_SUPPRESS_ISR_${module.driver.r_smb_master.name}) &amp;&amp; !defined(SSP_SUPPRESS_ISR_IIC${module.driver.r_smb_master.channel})
                    SSP_VECTOR_DEFINE_CHAN(smb_transmit_data_empty_isr, IIC, TXI, ${module.driver.r_smb_master.channel});
                #endif
                
                #if !defined(SSP_SUPPRESS_ISR_${module.driver.r_smb_master.name}) &amp;&amp; !defined(SSP_SUPPRESS_ISR_IIC${module.driver.r_smb_master.channel})
                    SSP_VECTOR_DEFINE_CHAN(smb_transmit_end_isr, IIC, TEI, ${module.driver.r_smb_master.channel});
                #endif
                
                #if !defined(SSP_SUPPRESS_ISR_${module.driver.r_smb_master.name}) &amp;&amp; !defined(SSP_SUPPRESS_ISR_IIC${module.driver.r_smb_master.channel})
                    SSP_VECTOR_DEFINE_CHAN(smb_error_event_isr, IIC, ERI, ${module.driver.r_smb_master.channel});
                #endif
                
                #if !defined(SSP_SUPPRESS_ISR_${module.driver.timer.name}) &amp;&amp; !defined(SSP_SUPPRESS_ISR_GPT${module.driver.timer.timer_channel})
                    SSP_VECTOR_DEFINE_CHAN(smb_counter_overflow_isr, GPT, COUNTER_OVERFLOW, ${module.driver.timer.timer_channel});
                #endif

    But in the file generated by the e2studio "new_thread0.c" I can see the following part:

    #if !defined(SSP_SUPPRESS_ISR_g_smb0) && !defined(SSP_SUPPRESS_ISR_IIC0)
    SSP_VECTOR_DEFINE_CHAN(iic0_receive_data_full_isr, IIC, RXI, 0);
    #endif

    #if !defined(SSP_SUPPRESS_ISR_g_smb0) && !defined(SSP_SUPPRESS_ISR_IIC0)
    SSP_VECTOR_DEFINE_CHAN(iic0_transmit_data_empty_isr, IIC, TXI, 0);
    #endif

    #if !defined(SSP_SUPPRESS_ISR_g_smb0) && !defined(SSP_SUPPRESS_ISR_IIC0)
    SSP_VECTOR_DEFINE_CHAN(iic0_transmit_end_isr, IIC, TEI, 0);
    #endif

    #if !defined(SSP_SUPPRESS_ISR_g_smb0) && !defined(SSP_SUPPRESS_ISR_IIC0)
    SSP_VECTOR_DEFINE_CHAN(iic0_error_event_isr, IIC, ERI, 0);
    #endif

    #if !defined(SSP_SUPPRESS_ISR_g_timer0) && !defined(SSP_SUPPRESS_ISR_GPT0)
    SSP_VECTOR_DEFINE_CHAN(gpt_counter_overflow_isr, GPT, COUNTER_OVERFLOW, 0);
    #endif

    I thought, that the XML part should be copied directly into the mentioned file. Do I have to delete some other file in order to refresh it?

    The errors that you are getting are about declaring sub functions in r_smb_master.c.

    Regards,

    Gregor

     

     

  • In reply to gregoryg:

    is there an XML file in the project (in the .module_descritptions folder) that has the offending vector definitions in it? Also, the files in the .module_descritpions folder are cached, so once a project has been created, if the XML in the pack file is up dated, the updates won't be reflected in the .module_descriptions folder (you will have to manually replace the XML file to get the updates into the project, then re-generate the project contents).
  • In reply to gregoryg:

    Update:
    When I delete the whole project and creat a new one, then I get the same errors as you after compiling. So this has something to do with not properly cleaning the project after updating the drivers... But I have no clue what files have to be deleted and where.
  • In reply to Jeremy:

    Yes I'm aware of it and I have tryied to do so. But the result was the same as before. Any other places to look for?
  • In reply to Jeremy:

    The messages about "undefined reference to `smb_rxi_master'" are also very strage, because in the "r_smb_master.c" file the definitions are there befor the vector definition:

     

    /** Interrupt handlers */
    void smb_rxi_master (smb_instance_ctrl_t * p_ctrl);
    void smb_txi_master (smb_instance_ctrl_t * p_ctrl);
    void smb_tei_master (smb_instance_ctrl_t * p_ctrl);
    void smb_err_master (smb_instance_ctrl_t * p_ctrl);

     

    other code...

     

    void smb_receive_data_full_isr  (void);
    void smb_receive_data_full_isr  (void)
    {
        /* Save context if RTOS is used */
        SF_CONTEXT_SAVE

        /* Clear the IR flag */
        R_BSP_IrqStatusClear (R_SSP_CurrentIrqGet());

        ssp_vector_info_t * p_vector_info = NULL;
        R_SSP_VectorInfoGet(R_SSP_CurrentIrqGet(), &p_vector_info);
        smb_instance_ctrl_t * p_ctrl = (smb_instance_ctrl_t *) *(p_vector_info->pp_ctrl);

        smb_rxi_master(p_ctrl);

        /* Restore context if RTOS is used */
        SF_CONTEXT_RESTORE
    }

     

    So, why is this showing up?

    Regards,

    Gregor

  • In reply to gregoryg:

    That is just the prototype of the function, not the actual definition of the function.
  • In reply to Jeremy:

    You are absolutley right:) I have forgot to add this. Now I'm getting no errors. Still a plenty of warnings that I have to take care of it.

    I will experiment a while with the XML files and see where is the information cached to investigate the first mentioned problem;)

    Thank you!

    Regards,
    Gregor