86
86
*/
87
87
#define OS_ERROR_NAME_LENGTH 35
88
88
89
+ /**
90
+ * @brief Type to be used for OSAL task priorities.
91
+ *
92
+ * OSAL priorities are in reverse order, and range
93
+ * from 0 (highest; will preempt all other tasks) to
94
+ * 255 (lowest; will not preempt any other task).
95
+ */
96
+ typedef uint8_t osal_priority_t ;
97
+
98
+ #define OSAL_PRIORITY_C (X ) ((osal_priority_t) {X})
99
+
100
+ /**
101
+ * @brief Type to be used for OSAL stack pointer.
102
+ */
103
+ typedef void * osal_stackptr_t ;
104
+
105
+ #define OSAL_STACKPTR_C (X ) ((osal_stackptr_t) {X})
106
+ #define OSAL_TASK_STACK_ALLOCATE OSAL_STACKPTR_C(NULL)
107
+
89
108
/* Object property structures */
90
109
91
110
/** @brief OSAL task properties */
92
111
typedef struct
93
112
{
94
- char name [OS_MAX_API_NAME ];
95
- osal_id_t creator ;
96
- uint32 stack_size ;
97
- uint32 priority ;
113
+ char name [OS_MAX_API_NAME ];
114
+ osal_id_t creator ;
115
+ size_t stack_size ;
116
+ osal_priority_t priority ;
98
117
} OS_task_prop_t ;
99
118
100
119
/** @brief OSAL queue properties */
@@ -140,9 +159,9 @@ typedef struct
140
159
*/
141
160
typedef struct
142
161
{
143
- uint32 free_bytes ;
144
- uint32 free_blocks ;
145
- uint32 largest_free_block ;
162
+ size_t free_bytes ;
163
+ osal_blockcount_t free_blocks ;
164
+ size_t largest_free_block ;
146
165
} OS_heap_prop_t ;
147
166
148
167
/**
@@ -467,7 +486,7 @@ static inline bool OS_ObjectIdDefined(osal_id_t object_id)
467
486
* #OS_INVALID_POINTER if the passed-in buffer is invalid
468
487
* #OS_ERR_NAME_TOO_LONG if the name will not fit in the buffer provided
469
488
*/
470
- int32 OS_GetResourceName (osal_id_t object_id , char * buffer , uint32 buffer_size );
489
+ int32 OS_GetResourceName (osal_id_t object_id , char * buffer , size_t buffer_size );
471
490
472
491
/*-------------------------------------------------------------------------------------*/
473
492
/**
@@ -480,7 +499,7 @@ int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size);
480
499
* @return The object type portion of the object_id, see @ref OSObjectTypes for
481
500
* expected values
482
501
*/
483
- uint32 OS_IdentifyObject (osal_id_t object_id );
502
+ osal_objtype_t OS_IdentifyObject (osal_id_t object_id );
484
503
485
504
/*-------------------------------------------------------------------------------------*/
486
505
/**
@@ -506,7 +525,7 @@ uint32 OS_IdentifyObject(osal_id_t object_id);
506
525
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
507
526
* @retval #OS_ERR_INCORRECT_OBJ_TYPE @copybrief OS_ERR_INCORRECT_OBJ_TYPE
508
527
*/
509
- int32 OS_ConvertToArrayIndex (osal_id_t object_id , uint32 * ArrayIndex );
528
+ int32 OS_ConvertToArrayIndex (osal_id_t object_id , osal_index_t * ArrayIndex );
510
529
511
530
/*-------------------------------------------------------------------------------------*/
512
531
/**
@@ -537,7 +556,7 @@ int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex);
537
556
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
538
557
* @retval #OS_ERR_INCORRECT_OBJ_TYPE @copybrief OS_ERR_INCORRECT_OBJ_TYPE
539
558
* */
540
- int32 OS_ObjectIdToArrayIndex (uint32 idtype , osal_id_t object_id , uint32 * ArrayIndex );
559
+ int32 OS_ObjectIdToArrayIndex (osal_objtype_t idtype , osal_id_t object_id , osal_index_t * ArrayIndex );
541
560
542
561
/*-------------------------------------------------------------------------------------*/
543
562
/**
@@ -566,7 +585,8 @@ void OS_ForEachObject(osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void
566
585
* @param[in] callback_ptr Function to invoke for each matching object ID
567
586
* @param[in] callback_arg Opaque Argument to pass to callback function
568
587
*/
569
- void OS_ForEachObjectOfType (uint32 objtype , osal_id_t creator_id , OS_ArgCallback_t callback_ptr , void * callback_arg );
588
+ void OS_ForEachObjectOfType (osal_objtype_t objtype , osal_id_t creator_id , OS_ArgCallback_t callback_ptr ,
589
+ void * callback_arg );
570
590
571
591
/*-------------------------------------------------------------------------------------*/
572
592
/**
@@ -617,8 +637,8 @@ int32 OS_RegisterEventHandler(OS_EventHandler_t handler);
617
637
* @retval #OS_ERR_NAME_TAKEN if the name specified is already used by a task
618
638
* @retval #OS_ERROR if an unspecified/other error occurs
619
639
*/
620
- int32 OS_TaskCreate (osal_id_t * task_id , const char * task_name , osal_task_entry function_pointer , uint32 * stack_pointer ,
621
- uint32 stack_size , uint32 priority , uint32 flags );
640
+ int32 OS_TaskCreate (osal_id_t * task_id , const char * task_name , osal_task_entry function_pointer ,
641
+ osal_stackptr_t stack_pointer , size_t stack_size , osal_priority_t priority , uint32 flags );
622
642
623
643
/*-------------------------------------------------------------------------------------*/
624
644
/**
@@ -687,7 +707,7 @@ int32 OS_TaskDelay(uint32 millisecond);
687
707
* @retval #OS_ERR_INVALID_PRIORITY if the priority is greater than the max allowed
688
708
* @retval #OS_ERROR if the OS call to change the priority fails
689
709
*/
690
- int32 OS_TaskSetPriority (osal_id_t task_id , uint32 new_priority );
710
+ int32 OS_TaskSetPriority (osal_id_t task_id , osal_priority_t new_priority );
691
711
692
712
/*-------------------------------------------------------------------------------------*/
693
713
/**
@@ -797,7 +817,8 @@ int32 OS_TaskFindIdBySystemData(osal_id_t *task_id, const void *sysdata, size_t
797
817
* @retval #OS_QUEUE_INVALID_SIZE if the queue depth exceeds the limit
798
818
* @retval #OS_ERROR if the OS create call fails
799
819
*/
800
- int32 OS_QueueCreate (osal_id_t * queue_id , const char * queue_name , uint32 queue_depth , uint32 data_size , uint32 flags );
820
+ int32 OS_QueueCreate (osal_id_t * queue_id , const char * queue_name , osal_blockcount_t queue_depth , size_t data_size ,
821
+ uint32 flags );
801
822
802
823
/*-------------------------------------------------------------------------------------*/
803
824
/**
@@ -839,7 +860,7 @@ int32 OS_QueueDelete(osal_id_t queue_id);
839
860
* @retval #OS_QUEUE_TIMEOUT if the timeout was OS_PEND and the time expired
840
861
* @retval #OS_QUEUE_INVALID_SIZE if the size copied from the queue was not correct
841
862
*/
842
- int32 OS_QueueGet (osal_id_t queue_id , void * data , uint32 size , uint32 * size_copied , int32 timeout );
863
+ int32 OS_QueueGet (osal_id_t queue_id , void * data , size_t size , size_t * size_copied , int32 timeout );
843
864
844
865
/*-------------------------------------------------------------------------------------*/
845
866
/**
@@ -857,7 +878,7 @@ int32 OS_QueueGet(osal_id_t queue_id, void *data, uint32 size, uint32 *size_copi
857
878
* @retval #OS_QUEUE_FULL if the queue cannot accept another message
858
879
* @retval #OS_ERROR if the OS call returns an error
859
880
*/
860
- int32 OS_QueuePut (osal_id_t queue_id , const void * data , uint32 size , uint32 flags );
881
+ int32 OS_QueuePut (osal_id_t queue_id , const void * data , size_t size , uint32 flags );
861
882
862
883
/*-------------------------------------------------------------------------------------*/
863
884
/**
0 commit comments