Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: common IRQ priority control command for the Device HAL #106

Open
alexeysmirnovspb opened this issue May 14, 2019 · 0 comments

Comments

@alexeysmirnovspb
Copy link

Issue Summary

  • Type: Enhancement
  • Category: Device HAL
  • Priority: High
  • Release Version:

Complex use-case usually requires IRQ priorities tuning according to the specific time constraints.
Since setting IRQ priority needs the knowledge of the particular device IRQ line numbers that is normally hidden by HAL, it is reasonable to add the new HAL API call to reuse the information from device description structure.

Please see code below, this is the example of the possible IRQ priority control command implementation for I2C driver:

  1. the new command ID definition in device/ip/ip_hal/inc/dev_iic.h:
             /**
              * Set the required IRQ priority level
              * - Param type : int32_t
              * - Param usage :
              * - Return value explanation :
              */
             #define IIC_CMD_SET_IRQ_PRIO           DEV_SET_IIC_SYSCMD(18)
  1. IRQ priority setting call (this call might be shared and declared outisde the I2C driver code, for example, as a macro) and the new command handler in device/ip/subsystem/iic/ss_i2c_master.c
             /* an inline procedure that sets the IRQ priority */
             Inline void ss_iic_set_irq_priority(uint32_t vector, uint32_t priority)
             {
                    _arc_aux_write(0x40b, vector);          /*IRQ_SELECT*/
                    _arc_aux_write(0x206, priority);        /*IRQ_LEVEL*/
             }

             <...>

             /* ...and finally adding the new command handler */
              int32_t ss_iic_master_close(SS_IIC_MASTER_DEV_CONTEXT *ctx)
              {
             <...>
                            case IIC_CMD_SET_IRQ_PRIO:
                                    val32 = (uint32_t)param;
                                    ss_iic_set_irq_priority(ctx->int_err, val32);
                                    ss_iic_set_irq_priority(ctx->int_rx_avail, val32);
                                    ss_iic_set_irq_priority(ctx->int_tx_req, val32);
                                    ss_iic_set_irq_priority(ctx->int_stop_det, val32);
                                    break;
             <...>
             }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant