We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
WHEN I COMPILE THIS CODE GIVEN BELOW IT GIVES ERRORS LIKE
error 52: Actual Argument type different from declaration 2 from type 'unsigned-char generic*' to type 'unsigned-char'
#include<8051.h> //--------------------------------------------------------------------------- #include "Kernel.h" #include "Task.h" #include "AVX.H"
//---------------------------------------------------------------------------
extern xdata unsigned char taskRdyQue[64]; extern unsigned char taskRdyMatrixIndex; extern xdata unsigned char taskRdyMatrix[8] ;
unsigned char TaskCreate(TaskFunc pTaskFunc,unsigned char priority,unsigned char idata *InternalSP,unsigned char xdata *ExternalSP)
{
if (g_Kernel.TaskCount >= OS_TASK_COUNT) return 0;
#ifdef PREEMPTIVE
priority = 63 - priority ;
taskRdyMatrixIndex |= ( 1<< (priority >> 3) );
taskRdyMatrix[priority >> 3] |= ( 1<<(priority & 7) );
taskRdyQue[priority]=g_Kernel.TaskCount;
#endif
// Initialize the Task object. // Push low byte of pTaskFunc.
(unsigned char)*(IntSP) = (unsigned short)pTaskFunc; // Push high byte of pTaskFunc. *(IntSP + 1) = (unsigned short)pTaskFunc >> 8; // The size of all registers is 13 bytes.
g_Kernel.Tasks[g_Kernel.TaskCount].InternalSP =(IntSP + 0x0E) ; g_Kernel.Tasks[g_Kernel.TaskCount].ExternalSP = ExternalSP;
*(g_Kernel.Tasks[g_Kernel.TaskCount].ExternalSP) = *(IntSP);//*( InternalSP - 1); *(g_Kernel.Tasks[g_Kernel.TaskCount].ExternalSP + 1 ) = *(IntSP + 1);//*( InternalSP );
g_Kernel.TaskCount++;
return 1; } //--------------------------------------------------------------------------- ///* unsigned char TaskPrioritySet(unsigned char old_priority, unsigned char new_priority) {
if( new_priority>63 || new_priority<0 ) return 0;
old_priority = 63 - old_priority ; // convert pseudo priority
// check if any other bit is set if set then don't update task ready mat. index // reseting the bit which shows task is present
if( !( taskRdyMatrix[old_priority >> 3] &= (~( 1<<(old_priority & 7) ))) ) taskRdyMatrixIndex &= (~( 1<< (old_priority >> 3) ));
new_priority = 63 - new_priority ; // convert pseudo priority
taskRdyMatrixIndex |= ( 1<< (new_priority >> 3) ); //update with new value
//update task ready matrix table taskRdyMatrix[new_priority >> 3] |= ( 1<<(new_priority & 7) );
// update task ready queue with earlier tcb array index taskRdyQue[new_priority] = taskRdyQue[old_priority];
taskRdyQue[old_priority] = 0; // reset older tcb array index
TF0 = 1; // call context switcher
return 1; }
unsigned char TaskPend(unsigned char priority) {
if( priority>63 || priority<0 ) return 0;
priority = 63 - priority;
if( !( taskRdyMatrix[priority >> 3] &= (~( 1<<(priority & 7) ))) ) taskRdyMatrixIndex &= (~( 1<< (priority >> 3) ));
TF0 = 1; // call context switcher return 1;
}
unsigned char TaskResume(unsigned char priority) {
if( taskRdyQue[priority] ) // CHECK FOR TASK SIGNATURE {
taskRdyMatrixIndex |= ( 1<< (priority >> 3) ); //update with new value
return 1; } }
unsigned char TaskDelete(unsigned char priority) {
if( priority<63 && priority>=0 ) { priority = 63 - priority;
taskRdyQue[priority] = 0;
} }
+++++____+++++++++++++__)))))))))))++++|||||||||||+++++
TASH.H FILE
//--------------------------------------------------------------------------- #ifndef TaskH #define TaskH //--------------------------------------------------------------------------- // Task function pointer.
#define PREEMPTIVE
typedef void (code *TaskFunc)();
typedef struct _Task { unsigned char idata *InternalSP; // Internal stack pointer. unsigned char xdata * ExternalSP; // External stack pointer(for reentrant function). } Task;
// Create a Task object. // Parameter: // pTaskFunc: The Task function pointer. // InternalSP: Internal stack pointer. // ExternalSP: External stack pointer. // Return value: // 0: Error. // 1: Success. unsigned char TaskCreate(TaskFunc pTaskFunc,unsigned char priority,unsigned char idata *InternalSP;unsigned char xdata *ExternalSP); unsigned char taskPrioritySet(unsigned char old_priority, unsigned char new_priority); unsigned char tickRateSet(unsigned char milli_sec); unsigned char taskDelete(unsigned char priority);
//--------------------------------------------------------------------------- #endif // ThreadH //---------------------------------------------------------------------------
HELP !
please re-post using the pre and /pre tags, and do add some clarifications...