aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c82
1 files changed, 72 insertions, 10 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 68bd680a8..64b6ac4e0 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -90,6 +90,7 @@ MillisecMotorDataStruc SpeedSetPending[NUM_OF_MOTORS] = {0};
MillisecMotorDataStruc PT100Data[MAX_TEMPERATURE_SENSOR_ID] = {0};
/******************** GLOBAL PARAMETERS ********************************************/
Mailbox_Handle MillisecMsgQ = NULL;
+Mailbox_Handle TenMillisecMsgQ = NULL;
Mailbox_Handle MotorsMsgQ[NUM_OF_MOTORS] = {NULL};
bool MillisecRestart;
static GateMutex_Handle gateMillisecDB;
@@ -114,6 +115,7 @@ void MillisecInit(void)
Error_init(&eb);
MillisecMsgQ = Mailbox_create(sizeof(MillisecMessageStruc), 2, NULL,&eb);
+ TenMillisecMsgQ = Mailbox_create(sizeof(MillisecMessageStruc), 2, NULL,&eb);
for (i=0;i<NUM_OF_MOTORS;i++)
{
MotorsMsgQ[i] = Mailbox_create(sizeof(MillisecMotorDataStruc), 5, NULL,&eb);
@@ -158,6 +160,7 @@ void MillisecStart(void)
void OneMilliSecondMillisecInterrupt(UArg arg0)
{
MillisecMessageStruc Message;
+ uint32_t Tenmsec_millisecondCounter = 0;
ROM_IntMasterDisable();
ROM_TimerIntClear(Millisec_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt
if (MillisecRestart == true)
@@ -170,13 +173,26 @@ void OneMilliSecondMillisecInterrupt(UArg arg0)
ROM_IntMasterEnable();
return;
}
+ if (msec_millisecondCounter%10 == 0)
+ {
+ Tenmsec_millisecondCounter = msec_millisecondCounter;
+ }
//send message to the Millisec task
Message.messageId = OneMillisec;
- Message.tick = msec_millisecondCounter++;;
+ Message.tick = msec_millisecondCounter++;
Message.msglen = sizeof(MillisecMessageStruc);
if (MillisecMsgQ != NULL)
Mailbox_post(MillisecMsgQ , &Message, BIOS_NO_WAIT);
+ if (Tenmsec_millisecondCounter)
+ {
+ Message.messageId = OneMillisec;
+ Message.tick = Tenmsec_millisecondCounter;
+ Message.msglen = sizeof(MillisecMessageStruc);
+ if (TenMillisecMsgQ != NULL)
+ Mailbox_post(TenMillisecMsgQ , &Message, BIOS_NO_WAIT);
+ }
+
//
// Enable all interrupts.
//
@@ -341,17 +357,16 @@ int32_t MillisecReadFromMotor(TimerMotors_t MotorId, unsigned long Data, int Len
else return false;
}
-//TEMPERATURE_SENSOR_ID_ENUM Sensor_Read = 0;
uint32_t MillisecLoop(uint32_t tick)
{
- uint8_t Motor_i,Disp_i;
+ uint8_t Motor_i;
TEMPERATURE_SENSOR_ID_ENUM Sensor_i;
unsigned int MotorInfo = 0;
static int temp=0;
//call all modules Millisec functions
//test dancers and speed encoders
//check all callback units (state machine waiting for completion of a change)
- bool Ten_msTick, Hundred_msTick, Onesecond_Tick,O900Millisecond_Tick,Tick98,OneMinute_Tick;
+/* bool Ten_msTick, Hundred_msTick, Onesecond_Tick,O900Millisecond_Tick,Tick98,OneMinute_Tick;
Ten_msTick = (tick%eTenMillisecond == 0) ?true:false;
Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false;
O900Millisecond_Tick = (tick%eOneSecond == 900) ?true:false;
@@ -360,7 +375,7 @@ uint32_t MillisecLoop(uint32_t tick)
Tick98 = (tick%eHundredMillisecond == 99) ?true:false;
//gather Motor data from FPGA
//ROM_IntMasterDisable();
-
+*/
#ifndef EVALUATION_BOARD
FPGA_GetBusy(); //load the busy motor information to all motors
FPGA_Read_limit_Switches_Registers();
@@ -473,6 +488,26 @@ uint32_t MillisecLoop(uint32_t tick)
Dancer_Data[FEEDER_DANCER] = Read_Dancer_Position(FEEDER_DANCER);
Dancer_Data[POOLER_DANCER] = Read_Dancer_Position(POOLER_DANCER);
Dancer_Data[WINDER_DANCER] = Read_Dancer_Position(WINDER_DANCER);
+ return OK;
+}
+uint32_t MillisecLowLoop(uint32_t tick)
+{
+ uint8_t Disp_i;
+ TEMPERATURE_SENSOR_ID_ENUM Sensor_i;
+
+ static int temp=0;
+ //call all modules Millisec functions
+ //test dancers and speed encoders
+ //check all callback units (state machine waiting for completion of a change)
+ bool Ten_msTick, Hundred_msTick, Onesecond_Tick,O900Millisecond_Tick,Tick98,OneMinute_Tick;
+ Ten_msTick = (tick%eTenMillisecond == 0) ?true:false;
+ Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false;
+ O900Millisecond_Tick = (tick%eOneSecond == 900) ?true:false;
+ Onesecond_Tick = (tick%eOneSecond == 0) ?true:false;
+ OneMinute_Tick = (tick%eOneMinute == 0) ?true:false;
+ //gather Motor data from FPGA
+ //ROM_IntMasterDisable();
+
if (Ten_msTick)
{
//Speed_Data = Calculate_Speed_Sensor_Velocity();
@@ -501,7 +536,7 @@ uint32_t MillisecLoop(uint32_t tick)
for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
{
CalculateDispenserPressure(Disp_i);
- Read_MidTank_Pressure_Sensor(Disp_i);
+ //Read_MidTank_Pressure_Sensor(Disp_i);
}
FPGA_GetAllDispensersValveBusyOCD();
DrawerFansStatus = Read_Fans_Tacho();
@@ -509,10 +544,10 @@ uint32_t MillisecLoop(uint32_t tick)
}
if (OneMinute_Tick)
{
- for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
- {
- Read_MidTank_Pressure_Sensor(Disp_i);
- }
+// for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
+// {
+// Read_MidTank_Pressure_Sensor(Disp_i);
+// }
/* for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++)
{
if (Motor_i == HARDWARE_MOTOR_TYPE__MOTO_SCREW)
@@ -553,6 +588,33 @@ void MillisecTask(UArg arg0, UArg arg1)
}
}
}
+/******************************************************************************
+ * ======== messageTsk ========
+ * Task for this function is created statically. See the project's .cfg file.
+ * this message task is created statically in system initialization,
+ ******************************************************************************/
+void MillisecLowTask(UArg arg0, UArg arg1)
+{
+ MillisecMessageStruc Message;
+ //char str[60];
+ //uint16_t length;
+ //Clock_setTimeout(HostKAClock, 1000);
+ //Clock_start(HostKAClock);
+ //MillisecInit();
+ //Millisecond_Task_Handle = Task_self();
+ while(1)
+ {
+ Mailbox_pend(TenMillisecMsgQ , &Message, BIOS_WAIT_FOREVER);
+ switch (Message.messageId)
+ {
+ case OneMillisec:
+ MillisecLowLoop(Message.tick);
+ break;
+ default:
+ break;
+ }
+ }
+}
/*uint32_t getMotorStatusData(int MotorId)