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

Function rt_pic_dynamic_cast

components/drivers/pic/pic.c:97–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97struct rt_pic *rt_pic_dynamic_cast(void *ptr)
98{
99 struct rt_pic *pic = RT_NULL, *tmp = RT_NULL;
100
101 if (ptr)
102 {
103 struct rt_object *obj = ptr;
104
105 if (obj->type == RT_Object_Class_Unknown)
106 {
107 tmp = (void *)obj;
108 }
109 else if (obj->type == RT_Object_Class_Device)
110 {
111 tmp = (void *)obj + sizeof(struct rt_device);
112 }
113 else
114 {
115 tmp = (void *)obj + sizeof(struct rt_object);
116 }
117
118 if (tmp && !rt_strcmp(tmp->parent.name, "PIC"))
119 {
120 pic = tmp;
121 }
122 }
123
124 return pic;
125}
126
127rt_err_t rt_pic_linear_irq(struct rt_pic *pic, rt_size_t irq_nr)
128{

Callers 3

ofw_msi_pic_initFunction · 0.85
ofw_map_irqFunction · 0.85

Calls 1

rt_strcmpFunction · 0.85

Tested by

no test coverage detected