This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UCD3138064: What is the mean of "void swi_single_entry(Uint32 arg1, Uint32 arg2, Uint32 arg3, Uint8 swi_number);" in ucd3138 ?

Part Number: UCD3138064
Other Parts Discussed in Thread: UCD3138

What is the mean of  "void swi_single_entry(Uint32 arg1, Uint32 arg2, Uint32 arg3, Uint8 swi_number);" in ucd3138 ?

what is the function in bootloader? 

thanks

 

  • Thank you for question. It is being looked into by the appropriate engineer.
  • With CCS 3.3, we had multiple entry points for the software interrupt which utilized the feature of the software interrupt instruction that provides an immediate byte in the instruction which is pointed to in a register.

    When we moved to CCS 6, we couldn't figure out how to do that.  So we switched to a single entry point with the value loaded by the call as swi_number.

    We also added the software interrupt wrapper.  Here's a little bit of the new software_interrupt.h:

    #pragma SWI_ALIAS (swi_single_entry, 0)
    void swi_single_entry(Uint32 arg1, Uint32 arg2, Uint32 arg3, Uint8 swi_number);
    //software_interrupts.h

    void erase_data_flash_segment(Uint8 segment);

    Now the swi_single_entry is the only software interrupt entry point, with an immediate byte value of zero. 

    The old software interrupt.h used to look like this:

    //software_interrupts.h
    #pragma SWI_ALIAS (erase_data_flash_segment, 0)
    void erase_data_flash_segment(Uint8 segment);

    #pragma SWI_ALIAS (erase_dflash_segment_no_delay, 1)
    void erase_dflash_segment_no_delay(Uint8 segment);

    #pragma SWI_ALIAS (write_data_flash_word, 3)
    void write_data_flash_word(unsigned long * address,unsigned long data);

    #pragma SWI_ALIAS (enable_fast_interrupt, 4)
    void enable_fast_interrupt(void);.....

    This let us use the immediate byte directly.  With CCS 6 we simulate this by putting the same number as function parameter and routing everything through single entry using the software interrupt wrapper:

    //software_interrupts.h
    void erase_data_flash_segment(Uint8 segment)
    {
         swi_single_entry(segment,0,0,0);
    }


    void erase_dflash_segment_no_delay(Uint8 segment)
    {
         swi_single_entry(segment,0,0,1);
    }


    void write_data_flash_word(Uint32 address,unsigned long data)
    {
         swi_single_entry(address,data,0,3);
    }


    void enable_fast_interrupt(void)
    {
         swi_single_entry(0,0,0,4);
    }

    The software interrupt instruction has a byte (in Thumb Mode), or more bits (in ARM mode).  In CCS3, we could access it using an assembly instruction:

     asm("  LDRB  R3,[R14,#-1]"); //get swi number into R3 as fourth operand

    In CCS 6, R14 seems to no longer be pointing to the SWI instruction, so we couldn't use this trick.  So we used the single entry point to explicitly put the same value into the fourth operand. 

    Probably too much information. 

    You can see that the fourth operand is used in the switch statement to decide which function the software interrupt does. 

    #pragma SWI_ALIAS (swi_single_entry, 0)

    void swi_single_entry(Uint32 arg1, Uint32 arg2, Uint32 arg3, Uint8 swi_number);

    //software_interrupts.h

    void erase_data_flash_segment(Uint8 segment);

  • Thank you for your reply .