Updated Aufgabe6

This commit is contained in:
Kai-Bjoern Gemlau
2020-05-29 12:03:48 +02:00
parent d9dcc0c06e
commit 7f950d9ccf
8 changed files with 15 additions and 148 deletions

View File

@@ -18,7 +18,7 @@ SRC += $(SRC_DIR)/APP/$(APP)/$(ARCH)/core$(CORE)/src/xttcps_g.c
SRC += $(SRC_DIR)/APP/$(APP)/$(ARCH)/core$(CORE)/src/xgpiops_g.c SRC += $(SRC_DIR)/APP/$(APP)/$(ARCH)/core$(CORE)/src/xgpiops_g.c
SRC += $(SRC_DIR)/APP/$(APP)/$(ARCH)/core$(CORE)/src/xiicps_g.c SRC += $(SRC_DIR)/APP/$(APP)/$(ARCH)/core$(CORE)/src/xiicps_g.c
SRC += $(SRC_DIR)/ucos_v1_42/micrium_source/uCOS-II/Ports/ARM-Cortex-A/Generic/GNU/os_cpu_a_vfp-none.S SRC += $(SRC_DIR)/ucos_v1_42/micrium_source/uCOS-II/Ports/ARM-Cortex-A/Generic/GNU/os_cpu_a_vfp-d32.S
SRC += $(SRC_DIR)/ucos_v1_42/micrium_source/uCOS-II/Ports/ARM-Cortex-A/Generic/GNU/os_cpu_c.c SRC += $(SRC_DIR)/ucos_v1_42/micrium_source/uCOS-II/Ports/ARM-Cortex-A/Generic/GNU/os_cpu_c.c
SRC += $(SRC_DIR)/ucos_v1_42/micrium_source/uC-CPU/Cache/ARM/armv7_generic_l1/GNU/cpu_cache_armv7_generic_l1_a.S SRC += $(SRC_DIR)/ucos_v1_42/micrium_source/uC-CPU/Cache/ARM/armv7_generic_l1/GNU/cpu_cache_armv7_generic_l1_a.S

View File

@@ -1,44 +0,0 @@
/*
* imu.h
*
* Created on: Nov 6, 2018
* Author: laurenzb
*/
#ifndef SRC_APP_AUFGABE7_PS7_CORE0_CFG_IMU_H_
#define SRC_APP_AUFGABE7_PS7_CORE0_CFG_IMU_H_
#include <stdio.h>
#include "xiicps.h"
#include "xparameters.h"
#define MPU9250_AD 0x68 //Adresse d. I²C slaves festlegen
#define GYRO_CONFIG_AD 0x1B //Gyroskop config register
#define ACCEL_CONFIG_1_AD 0x1C //Beschleunigungssensor config reg1
#define ACCEL_CONFIG_2_AD 0x1D //Beschleunigungssensor config reg1
#define CONFIG_AD 0x1A //IMU config reg
#define PWR_MGMT_1_AD 0x6B //cloc power management register
#define GYRO_XOUT_H_AD 0x43 //hier das Startregister der Gyroskopdaten
#define ACCEL_XOUT_H_AD 0x3B //startreg Accel Daten
#define IIC_DEVICE_ID XPAR_XIICPS_1_DEVICE_ID //??? in xparameters.h noch die iic Daten für das Gerät festlegen?
#define IIC_SCLK_RATE 100000
int mpu9250_Imu_Init(void *pdata);
uint8_t mpu9250_Iic_Init();
void mpu9250_Init(void);
uint8_t mpu9250_Write_Reg(uint8_t iic_address, uint8_t data);
int8_t mpu9250_Read_Data(uint8_t iic_address, uint8_t length, u8 RecvBuffer[]);
uint8_t mpu9250_Map_Gyro_Data(int16_t result[]);
uint8_t mpu9250_Map_Acc_Data(int16_t result[]);
uint8_t mpu9250_Read_Status(int16_t result[]);
int mpu9250_Get_Data_Task(void *pdata);
#endif /* SRC_APP_AUFGABE7_PS7_CORE0_CFG_IMU_H_ */

View File

@@ -1,18 +0,0 @@
/*
* pid.h
*
* Created on: Jan 28, 2019
* Author: laurenzb
*/
#ifndef SRC_APP_AUFGABE7_PS7_CORE0_CFG_PID_H_
#define SRC_APP_AUFGABE7_PS7_CORE0_CFG_PID_H_
unsigned int pid_Init(void *pdata);
int16_t pid_Constrain(int16_t value, int16_t lowerBorder, int16_t higherBorder);
int pid_Task(void *pdata);
int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max);
#endif /* SRC_APP_AUFGABE7_PS7_CORE0_CFG_PID_H_ */

View File

@@ -1,20 +0,0 @@
/*
* Created on: Nov 6, 2018
* Author: laurenzb
*/
int Task_A(void *pdata);
int task_a_init(void *pdata);
int Task_B(void *pdata);
int task_b_init(void *pdata);
int Task_C(void *pdata);
int task_c_init(void *pdata);
int Task_D(void *pdata);
int task_d_init(void *pdata);
int Task_E(void *pdata);
int task_e_init(void *pdata);

View File

@@ -1,32 +0,0 @@
/*
* ttc_timer.h
*
* Created on: Nov 13, 2018
* Author: laurenzb
*/
#include <stdint.h>
#ifndef SRC_APP_AUFGABE7_PS7_CORE0_CFG_TTC_TIMER_H_
#define SRC_APP_AUFGABE7_PS7_CORE0_CFG_TTC_TIMER_H_
//#define INTC_DEVICE_ID XPAR_SCUGIC_0_DEVICE_ID
//#define TTC_DEVICE_ID XPAR_XTTCPS_0_DEVICE_ID
//#define TICK_TIMER_FREQ_HZ 100 /* Tick timer counter's output frequency */
//#define TTC_PWM_DEVICE_ID XPAR_XTTCPS_0_DEVICE_ID
//
//
//#define TTC_PWM_DEVICE_ID XPAR_XTTCPS_0_DEVICE_ID
//#define TTC_PWM_INTR_ID XPAR_XTTCPS_0_INTR
//#define TTCPS_CLOCK_HZ XPAR_XTTCPS_0_CLOCK_HZ
//
//
//#define TICK_TIMER_FREQ_HZ 100 /* Tick timer counter's output frequency */
//#define PWM_OUT_FREQ 350 /* PWM timer counter's output frequency */
//
//#define TICKS_PER_CHANGE_PERIOD TICK_TIMER_FREQ_HZ * 5 /* Tick signals PWM */
int timer_Task(void *pdata);
int timer_Init();
#endif /* SRC_APP_AUFGABE7_PS7_CORE0_CFG_TTC_TIMER_H_ */

View File

@@ -4,7 +4,7 @@
Author : Kai-Björn Gemlau Author : Kai-Björn Gemlau
Version : Version :
Copyright : Copyright belongs to the authors Copyright : Copyright belongs to the authors
Description : Hello World in C, Praktikum Aufgabe 7s Description : Hello World in C, Praktikum Aufgabe 6
============================================================================ ============================================================================
*/ */
@@ -15,8 +15,6 @@
#include "ucos_bsp.h" #include "ucos_bsp.h"
#include "xil_testmem.h" #include "xil_testmem.h"
#include "xil_printf.h" #include "xil_printf.h"
#include "imu.h"
#include "ttc_timer.h"
#include "gt_core.h" #include "gt_core.h"
#include "gt_cpu.h" #include "gt_cpu.h"
@@ -26,19 +24,14 @@ void InitDoneCallback(void * p_arg) {
(void) p_arg; (void) p_arg;
UCOS_Print("OS started!\r\n"); UCOS_Print("OS started!\r\n");
GT_Init(); GT_Init();
} }
int main(void) { int main(void) {
MMUInit(); MMUInit();
GT_Calibrate(); GT_Calibrate();
UCOSStartup(InitDoneCallback); UCOSStartup(InitDoneCallback);
while (1) while (1)
; ;
} }

View File

@@ -151,6 +151,9 @@ void App_TaskDelHook (OS_TCB *ptcb)
#if OS_VERSION >= 251 #if OS_VERSION >= 251
void App_TaskIdleHook (void) void App_TaskIdleHook (void)
{ {
__asm volatile( "dsb" );
__asm volatile( "wfi" );
__asm volatile( "isb" );
} }
#endif #endif

View File

@@ -5,20 +5,14 @@
* Author: matthiasb * Author: matthiasb
*/ */
#include "ucos_uartps.h" #include "ucos_uartps.h"
#include "xil_printf.h" #include "xil_printf.h"
#include "ucos_ii.h" #include "ucos_ii.h"
#include "ucos_bsp.h" #include "ucos_bsp.h"
#include "gt_types.h" #include "gt_types.h"
//#include "gt_cfg_types.h"
#include "gt_cfg.h" #include "gt_cfg.h"
#include <string.h> /* memset */ #include <string.h> /* memset */
#include "tasks.h"
#define TASK_A_PRIO 11 #define TASK_A_PRIO 11
#define TASK_B_PRIO #define TASK_B_PRIO
@@ -26,12 +20,6 @@
#define TASK_D_PRIO #define TASK_D_PRIO
#define TASK_E_PRIO #define TASK_E_PRIO
#define TASK_STK_SIZE 256
static OS_STK TaskStacks[GT_NUM_OF_TASKS][TASK_STK_SIZE];
/*-------------------------------Task model internal struct definitions-------------------------------*/
/*------------------------------------Execution times and periods-------------------------------------*/ /*------------------------------------Execution times and periods-------------------------------------*/
@@ -51,15 +39,12 @@ GT_TASK_EXT_T GT_AllTasks[GT_NUM_OF_TASKS] = {
{200, 0, 0, {2, 5}}, {200, 0, 0, {2, 5}},
}; };
/*------------------------------------Internal call back functions-------------------------------------*/
/* /*
* Main task table, used for GT_Init call * Main task table, used for GT_Init call
*/ */
GT_TASK_T GT_Tasks[GT_NUM_OF_TASKS] = GT_TASK_T GT_Tasks[GT_NUM_OF_TASKS] =
{ {
/*Type Activation Id Prio Next Activation CET Task init Function Task Function TaskArg D WL/Runable Internal External */ /*Type Activation Id Prio init Function Task Function TaskArg WL/Runable Internal External */
{ GT_TASK_DEF , GT_ACT_INT , 0, TASK_A_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[0]}, { GT_TASK_DEF , GT_ACT_INT , 0, TASK_A_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[0]},
{ GT_TASK_DEF , GT_ACT_INT , 1, TASK_B_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[1]}, { GT_TASK_DEF , GT_ACT_INT , 1, TASK_B_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[1]},
{ GT_TASK_DEF , GT_ACT_INT , 2, TASK_C_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[2]}, { GT_TASK_DEF , GT_ACT_INT , 2, TASK_C_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[2]},
@@ -67,15 +52,9 @@ GT_TASK_T GT_Tasks[GT_NUM_OF_TASKS] =
{ GT_TASK_DEF , GT_ACT_INT , 4, TASK_E_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[4]}, { GT_TASK_DEF , GT_ACT_INT , 4, TASK_E_PRIO, NULL ,NULL , NULL, GT_RUNABLE_NULL, GT_INTERNAL_NULL, (void *)&GT_AllTasks[4]},
}; };
/* void _taskActivated(void){
* Internal activation return;
*/ }
/*
*
* start and end hooks
*
*/
void _taskScheduled(void){ void _taskScheduled(void){
return; return;
@@ -93,6 +72,9 @@ void _taskFinished(void){
return; return;
} }
void GT_TaskActivationHook(GT_TASK_T *pMyOwnTask) {
//call _taskActivated
}
void GT_TaskStartHook(GT_TASK_T *pMyOwnTask) { void GT_TaskStartHook(GT_TASK_T *pMyOwnTask) {
//call _taskStarted //call _taskStarted
@@ -112,4 +94,7 @@ void GT_TaskSwHook(GT_TASK_T *pMyOwnTask) {
//call Task scheduled or not //call Task scheduled or not
} }
void GT_TaskMissHook(GT_TASK_T *pMyOwnTask){
//This is called if a deadline is missed (implicit deadlines)
}