File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,23 @@ const char *rt_dm_dev_get_name(rt_device_t dev)
306306#define ofw_api_call_ptr (name , ...) RT_NULL
307307#endif
308308
309+ rt_bool_t rt_dm_dev_is_big_endian (rt_device_t dev )
310+ {
311+ if (rt_dm_dev_prop_read_bool (dev , "big-endian" ))
312+ {
313+ return RT_TRUE ;
314+ }
315+
316+ #ifdef ARCH_CPU_BIG_ENDIAN
317+ if (rt_dm_dev_prop_read_bool (dev , "native-endian" ))
318+ {
319+ return RT_TRUE ;
320+ }
321+ #endif /* ARCH_CPU_BIG_ENDIAN */
322+
323+ return RT_FALSE ;
324+ }
325+
309326int rt_dm_dev_get_address_count (rt_device_t dev )
310327{
311328 RT_ASSERT (dev != RT_NULL );
@@ -480,6 +497,20 @@ void rt_dm_dev_unbind_fwdata(rt_device_t dev, void *fw_np)
480497#endif
481498}
482499
500+ const char * rt_dm_dev_get_prop_fuzzy_name (rt_device_t dev , const char * name )
501+ {
502+ RT_ASSERT (dev != RT_NULL );
503+
504+ #ifdef RT_USING_OFW
505+ if (dev -> ofw_node )
506+ {
507+ return ofw_api_call_ptr (get_prop_fuzzy_name , dev -> ofw_node , name );
508+ }
509+ #endif
510+
511+ return RT_NULL ;
512+ }
513+
483514int rt_dm_dev_prop_read_u8_array_index (rt_device_t dev , const char * propname ,
484515 int index , int nr , rt_uint8_t * out_values )
485516{
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ int rt_dm_dev_get_name_id(rt_device_t dev);
7070int rt_dm_dev_set_name (rt_device_t dev , const char * format , ...);
7171const char * rt_dm_dev_get_name (rt_device_t dev );
7272
73+ rt_bool_t rt_dm_dev_is_big_endian (rt_device_t dev );
74+
7375int rt_dm_dev_get_address_count (rt_device_t dev );
7476rt_err_t rt_dm_dev_get_address (rt_device_t dev , int index ,
7577 rt_uint64_t * out_address , rt_uint64_t * out_size );
@@ -87,6 +89,8 @@ int rt_dm_dev_get_irq_by_name(rt_device_t dev, const char *name);
8789void rt_dm_dev_bind_fwdata (rt_device_t dev , void * fw_np , void * data );
8890void rt_dm_dev_unbind_fwdata (rt_device_t dev , void * fw_np );
8991
92+ const char * rt_dm_dev_get_prop_fuzzy_name (rt_device_t dev , const char * name );
93+
9094int rt_dm_dev_prop_read_u8_array_index (rt_device_t dev , const char * propname ,
9195 int index , int nr , rt_uint8_t * out_values );
9296int rt_dm_dev_prop_read_u16_array_index (rt_device_t dev , const char * propname ,
You can’t perform that action at this time.
0 commit comments