@@ -663,58 +663,6 @@ void OS_Unlock_Global(uint32 idtype)
663
663
}
664
664
}
665
665
666
-
667
- /*----------------------------------------------------------------
668
- *
669
- * Function: OS_ObjectIdToArrayIndex
670
- *
671
- * Purpose: Local helper routine, not part of OSAL API.
672
- * Convert an object ID (which must be of the given type) to a number suitable
673
- * for use as an array index. The array index will be in the range of:
674
- * 0 <= ArrayIndex < OS_MAX_<OBJTYPE>
675
- *
676
- * If the passed-in ID type is OS_OBJECT_TYPE_UNDEFINED, then any type
677
- * is allowed.
678
- *
679
- * returns: If the passed-in ID is not of the proper type, OS_ERROR is returned
680
- * Otherwise OS_SUCCESS is returned.
681
- *
682
- *-----------------------------------------------------------------*/
683
- int32 OS_ObjectIdToArrayIndex (uint32 idtype , osal_id_t id , uint32 * ArrayIndex )
684
- {
685
- uint32 max_id ;
686
- uint32 obj_index ;
687
- uint32 actual_type ;
688
- int32 return_code ;
689
-
690
- obj_index = OS_ObjectIdToSerialNumber_Impl (id );
691
- actual_type = OS_ObjectIdToType_Impl (id );
692
-
693
- /*
694
- * If requested by the caller, enforce that the ID is of the correct type.
695
- * If the caller passed OS_OBJECT_TYPE_UNDEFINED, then anything is allowed.
696
- */
697
- if (idtype != OS_OBJECT_TYPE_UNDEFINED && actual_type != idtype )
698
- {
699
- return_code = OS_ERR_INVALID_ID ;
700
- }
701
- else
702
- {
703
- max_id = OS_GetMaxForObjectType (actual_type );
704
- if (max_id == 0 )
705
- {
706
- return_code = OS_ERR_INVALID_ID ;
707
- }
708
- else
709
- {
710
- return_code = OS_SUCCESS ;
711
- * ArrayIndex = obj_index % max_id ;
712
- }
713
- }
714
-
715
- return return_code ;
716
- } /* end OS_ObjectIdToArrayIndex */
717
-
718
666
/*----------------------------------------------------------------
719
667
*
720
668
* Function: OS_ObjectIdFinalizeNew
@@ -1249,3 +1197,54 @@ int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size)
1249
1197
} /* end OS_GetResourceName */
1250
1198
1251
1199
1200
+ /*----------------------------------------------------------------
1201
+ *
1202
+ * Function: OS_ObjectIdToArrayIndex
1203
+ *
1204
+ * Purpose: Convert an object ID (which must be of the given type) to a number suitable
1205
+ * for use as an array index. The array index will be in the range of:
1206
+ * 0 <= ArrayIndex < OS_MAX_<OBJTYPE>
1207
+ *
1208
+ * If the passed-in ID type is OS_OBJECT_TYPE_UNDEFINED, then any type
1209
+ * is allowed.
1210
+ *
1211
+ * returns: If the passed-in ID is not of the proper type, OS_ERROR is returned
1212
+ * Otherwise OS_SUCCESS is returned.
1213
+ *
1214
+ *-----------------------------------------------------------------*/
1215
+ int32 OS_ObjectIdToArrayIndex (uint32 idtype , osal_id_t id , uint32 * ArrayIndex )
1216
+ {
1217
+ uint32 max_id ;
1218
+ uint32 obj_index ;
1219
+ uint32 actual_type ;
1220
+ int32 return_code ;
1221
+
1222
+ obj_index = OS_ObjectIdToSerialNumber_Impl (id );
1223
+ actual_type = OS_ObjectIdToType_Impl (id );
1224
+
1225
+ /*
1226
+ * If requested by the caller, enforce that the ID is of the correct type.
1227
+ * If the caller passed OS_OBJECT_TYPE_UNDEFINED, then anything is allowed.
1228
+ */
1229
+ if (idtype != OS_OBJECT_TYPE_UNDEFINED && actual_type != idtype )
1230
+ {
1231
+ return_code = OS_ERR_INVALID_ID ;
1232
+ }
1233
+ else
1234
+ {
1235
+ max_id = OS_GetMaxForObjectType (actual_type );
1236
+ if (max_id == 0 )
1237
+ {
1238
+ return_code = OS_ERR_INVALID_ID ;
1239
+ }
1240
+ else
1241
+ {
1242
+ return_code = OS_SUCCESS ;
1243
+ * ArrayIndex = obj_index % max_id ;
1244
+ }
1245
+ }
1246
+
1247
+ return return_code ;
1248
+ } /* end OS_ObjectIdToArrayIndex */
1249
+
1250
+
0 commit comments