MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_pic_linear_irq

Function rt_pic_linear_irq

components/drivers/pic/pic.c:127–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127rt_err_t rt_pic_linear_irq(struct rt_pic *pic, rt_size_t irq_nr)
128{
129 rt_err_t err = RT_EOK;
130
131 if (pic && pic->ops && pic->ops->name)
132 {
133 rt_ubase_t level = rt_spin_lock_irqsave(&_pic_lock);
134
135 if (_pirq_hash_idx + irq_nr <= RT_ARRAY_SIZE(_pirq_hash))
136 {
137 rt_list_init(&pic->list);
138
139 rt_pic_default_name(pic);
140 pic->parent.type = RT_Object_Class_Unknown;
141
142 pic->irq_start = _pirq_hash_idx;
143 pic->irq_nr = irq_nr;
144 pic->pirqs = &_pirq_hash[_pirq_hash_idx];
145
146 _pirq_hash_idx += irq_nr;
147
148 append_pic(pic);
149
150 LOG_D("%s alloc irqs ranges [%d, %d]", pic->ops->name,
151 pic->irq_start, pic->irq_start + pic->irq_nr);
152 }
153 else
154 {
155 LOG_E("%s alloc %d irqs is overflow", pic->ops->name, irq_nr);
156
157 err = -RT_EEMPTY;
158 }
159
160 rt_spin_unlock_irqrestore(&_pic_lock, level);
161 }
162 else
163 {
164 err = -RT_EINVAL;
165 }
166
167 return err;
168}
169
170rt_err_t rt_pic_cancel_irq(struct rt_pic *pic)
171{

Callers 6

dw_pcie_host_initFunction · 0.85
pin_pic_initFunction · 0.85
gicv2m_ofw_probeFunction · 0.85
gicv3_initFunction · 0.85
gicv3_its_ofw_probeFunction · 0.85
gicv2_initFunction · 0.85

Calls 5

rt_list_initFunction · 0.85
rt_pic_default_nameFunction · 0.85
append_picFunction · 0.85
rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected