① Difference between variable size memory pool and fixed size memory pool
② ITRON implementation of ref_mpl()
ER ref_mpl(ID mplid, T_RMPL *pk_rmpl)
{
Sanity check on arguments
Enter critical section (Interrupt Disable)
List is parsed through and the sizes are accumulated and
maximum of single block size also kept recorded;
Both are stored in the structure;
Parse through the queue to get ID number of task at the head
if valid task found {
Store ID number in the structure
Exit critical section (Interrupt Restore)
return E_OK;
}
Store the task id as TSK_NONE;
Exit critical section (Interrupt Restore)
return E_OK;
}
③ ITRON implementation of ref_mpf()
ER ref_mpf(ID mpfid, T_RMPF *pk_rmpf)
{
Sanity check on arguments
Enter critical section (Interrupt Disable)
Store the counter for number of free blocks in the structure;
If (list head points to NULL) {
parse through the queue to get ID number of task at the head
if valid task found {
Store ID number in the structure
Exit critical section (Interrupt Restore)
return E_OK;
}
}
Store the task id as TSK_NONE;
Exit critical section (Interrupt Restore)
return E_OK;
}
Parsing through the list is required in case of variable memory pool. Otherwise, both are almost same.
② ITRON implementation of ref_mpl()
ER ref_mpl(ID mplid, T_RMPL *pk_rmpl)
{
Sanity check on arguments
Enter critical section (Interrupt Disable)
List is parsed through and the sizes are accumulated and
maximum of single block size also kept recorded;
Both are stored in the structure;
Parse through the queue to get ID number of task at the head
if valid task found {
Store ID number in the structure
Exit critical section (Interrupt Restore)
return E_OK;
}
Store the task id as TSK_NONE;
Exit critical section (Interrupt Restore)
return E_OK;
}
③ ITRON implementation of ref_mpf()
ER ref_mpf(ID mpfid, T_RMPF *pk_rmpf)
{
Sanity check on arguments
Enter critical section (Interrupt Disable)
Store the counter for number of free blocks in the structure;
If (list head points to NULL) {
parse through the queue to get ID number of task at the head
if valid task found {
Store ID number in the structure
Exit critical section (Interrupt Restore)
return E_OK;
}
}
Store the task id as TSK_NONE;
Exit critical section (Interrupt Restore)
return E_OK;
}
No comments:
Post a Comment