aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-05-08 14:26:40 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-05-08 14:26:40 +0300
commitdb0c657de9daf7f4d99e3167a337ebcd79771d8e (patch)
treef5c99ac8e967bc7d3f513d7a47640f5e96f041cc /Software/Embedded_SW/Embedded/Modules
parentdc911b096b06388d9bf84d86d35c8d19c84d6e4b (diff)
parent706b7f128efe759c7f8efe5379b572aca45e8c7e (diff)
downloadTango-db0c657de9daf7f4d99e3167a337ebcd79771d8e.tar.gz
Tango-db0c657de9daf7f4d99e3167a337ebcd79771d8e.zip
Merge trial
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c51
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_TivaReg.c15
3 files changed, 44 insertions, 25 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 0ab763a3f..12603b5ee 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -225,8 +225,9 @@ uint32_t MillisecLoop(uint32_t tick)
//gather Motor data from FPGA
#ifndef EVALUATION_BOARD
- FPGA_GetBusy(); //load the busy motor information to all motors
+ FPGA_GetBusy(); //load the busy motor information to all motors
#endif
+
for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++)
{
if (MotorDriverResponse[Motor_i].Busy == true)
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c
index 0b78988de..e7b75cc9d 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c
@@ -508,8 +508,17 @@ void Stub_MotorPositionRequest(MessageContainer* requestContainer)
response.motor_id = request->motor_id;
response.has_motor_id = true;
+ #ifdef EVALUATION_BOARD
+ response.position = Get_Param(x_ABS_POS);
- response.position = Get_Param(x_ABS_POS);
+ #else
+ TimerMotors_t Motor_Id = (TimerMotors_t)request->motor_id; //to remove warning
+ MotorGetPositionFromFPGA(Motor_Id);
+ //deley TODO
+ SysCtlDelay(10000);
+ response.position = MotorGetPositionFromFPGA_Res(Motor_Id);
+
+ #endif
response.has_position = true;
responseContainer = createContainer(MESSAGE_TYPE__StubMotorPositionResponse, requestContainer->token, true, &response, &stub_motor_position_response__pack, &stub_motor_position_response__get_packed_size);
@@ -537,37 +546,43 @@ void Stub_MotorMovRequest(MessageContainer* requestContainer)
Pos_Value = request->position;
Direction = request->direction;
- Mot_Mov();
+ #ifdef EVALUATION_BOARD
+ Mot_Mov();
+ #else
+ TimerMotors_t Motor_Id = (TimerMotors_t)request->motor_id; //to remove warning
+
+ MotorMove(Motor_Id, Direction, Pos_Value );
+ #endif
StubMotorMovResponse response = STUB_MOTOR_MOV_RESPONSE__INIT;
response.motor_id = request->motor_id;
response.has_motor_id = true;
+ #ifdef EVALUATION_BOARD
+ response.position = Get_Param(x_ABS_POS);
+ response.has_position = true;
- response.position = Get_Param(x_ABS_POS);
- response.has_position = true;
-
- while(SSIBusy(SSI2_BASE)){};
-
- read_status = Get_and_Clear_Status();
+ while(SSIBusy(SSI2_BASE)){};
+ read_status = Get_and_Clear_Status();
- response.status_reg = read_status;
- response.has_status_reg = true;
- response.direction = ((read_status & x_STATUS_DIR)>>4);
- response.has_direction = true;
+ response.status_reg = read_status;
+ response.has_status_reg = true;
- response.step_loss_a = ((read_status & x_STATUS_STEP_LOSS_A)>>13);
- response.has_step_loss_a = true;
- response.step_loss_b = ((read_status & x_STATUS_STEP_LOSS_B)>>14);
- response.has_step_loss_b = true;
+ response.direction = ((read_status & x_STATUS_DIR)>>4);
+ response.has_direction = true;
+ response.step_loss_a = ((read_status & x_STATUS_STEP_LOSS_A)>>13);
+ response.has_step_loss_a = true;
+ response.step_loss_b = ((read_status & x_STATUS_STEP_LOSS_B)>>14);
+ response.has_step_loss_b = true;
- response.mot_status = ((read_status & x_STATUS_MOT_STATUS)>>5);
- response.has_mot_status = true;
+ response.mot_status = ((read_status & x_STATUS_MOT_STATUS)>>5);
+ response.has_mot_status = true;
+ #endif
responseContainer = createContainer(MESSAGE_TYPE__StubMotorMovResponse, requestContainer->token, true, &response, &stub_motor_mov_response__pack, &stub_motor_mov_response__get_packed_size);
//free(request);
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_TivaReg.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_TivaReg.c
index ef2d7321c..ee4aca19d 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_TivaReg.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_TivaReg.c
@@ -44,12 +44,14 @@ void Stub_TivaReadRegRequest(MessageContainer* requestContainer)
status_response(status,&response.status, &response.statusword ,&response.has_statusword);
- volatile short *ptr;
- ptr = (volatile short *) (request->address);
+ //volatile short *ptr;
+ //ptr = (volatile short *) (request->address);
+ //response.value = *ptr;
response.address = request->address;
response.has_address = true;
- response.value = *ptr;
+
+ response.value = HWREG(request->address);
response.has_value = true;
@@ -79,9 +81,10 @@ void Stub_TivaWriteRegRequest(MessageContainer* requestContainer)
StubTivaWriteRegRequest* request = stub_tiva_write_reg_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
- volatile short *ptr;
- ptr = (volatile short *) (request->address);
- *ptr = (request->value & 0xFFFF);
+ //volatile short *ptr;
+ //ptr = (volatile short *) (request->address);
+ //*ptr = (request->value & 0xFFFF);
+ HWREG(request->address) = request->value;
StubTivaWriteRegResponse response = STUB_TIVA_WRITE_REG_RESPONSE__INIT;