Skip to content

Commit

Permalink
msp430 experimental support added
Browse files Browse the repository at this point in the history
  • Loading branch information
EDI-Systems committed Feb 26, 2018
1 parent c8f369a commit 1801dbc
Show file tree
Hide file tree
Showing 788 changed files with 82,451 additions and 5 deletions.
86 changes: 86 additions & 0 deletions MProkaron/Benchmark/Platform/test_MSP430FR5994.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/******************************************************************************
Filename : test_MSP430FR5994.h
Author : pry
Date : 22/07/2017
Licence : LGPL v3+; see COPYING for details.
Description : The testbench for MSP430FR5994.
******************************************************************************/

/* Includes ******************************************************************/
#include "RMP.h"
/* End Includes **************************************************************/

/* Defines *******************************************************************/
/* How to read counter */
#define COUNTER_READ() 0 //((TIM2->CNT)<<1)
/* Are we doing minimal measurements? */
/* #define MINIMAL_SIZE */
/* The MSP430 timers are all 16 bits, so */
typedef u16 tim_t;
/* End Defines ***************************************************************/

/* Globals *******************************************************************/
#ifndef MINIMAL_SIZE
void Int_Handler(void);
ptr_t Stack_1[128];
struct RMP_Thd Thd_1={0};
ptr_t Stack_2[128];
struct RMP_Thd Thd_2={0};
struct RMP_Sem Sem_1={0};
//TIM_HandleTypeDef TIM2_Handle={0};
//TIM_HandleTypeDef TIM4_Handle={0};
/* End Globals ***************************************************************/

/* Begin Function:Timer_Init **************************************************
Description : Initialize the timer for timing measurements. This function needs
to be adapted to your specific hardware.
Input : None.
Output : None.
Return : None.
******************************************************************************/
void Timer_Init(void)
{
/* Initialize timer 2 to run at the same speed as the CPU */

}
/* End Function:Timer_Init ***************************************************/

/* Begin Function:Int_Init ****************************************************
Description : Initialize an periodic interrupt source. This function needs
to be adapted to your specific hardware.
Input : None.
Output : None.
Return : None.
******************************************************************************/
void Int_Init(void)
{
/* Initialize timer 2 to run at the same speed as the CPU */

}


/* The interrupt handler */
void TIM4_IRQHandler(void)
{
Int_Handler();
}
/* End Function:Int_Init *****************************************************/

/* Begin Function:Int_Disable *************************************************
Description : Disable the periodic interrupt source. This function needs
to be adapted to your specific hardware.
Input : None.
Output : None.
Return : None.
******************************************************************************/
void Int_Disable(void)
{
/* Disable timer 4 interrupt */

}
#endif
/* End Function:Int_Disable **************************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/
4 changes: 2 additions & 2 deletions MProkaron/Benchmark/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ void RMP_Init_Hook(void)
/* Create counting semaphore */
RMP_Sem_Crt(&Sem_1,0);
/* Start threads */
RMP_Thd_Crt(&Thd_1, Func_1, &Stack_1[256], (void*)0x12345678, 1, 5);
RMP_Thd_Crt(&Thd_2, Func_2, &Stack_2[256], (void*)0x87654321, 1, 5);
RMP_Thd_Crt(&Thd_1, Func_1, &Stack_1[100], (void*)0x1234, 1, 5);
RMP_Thd_Crt(&Thd_2, Func_2, &Stack_2[100], (void*)0x4321, 1, 5);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion MProkaron/Benchmark/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: The configuration file for testing program.
******************************************************************************/

/* Config Includes ***********************************************************/
#include "Platform/test_PIC32MZ2048EFM100.h"
#include "Platform/test_MSP430FR5994.h"
/* End Config Includes *******************************************************/

/* End Of File ***************************************************************/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/******************************************************************************
Filename : platform_MSP430FR5994.h
Author : pry
Date : 24/06/2017
Licence : LGPL v3+; see COPYING for details.
Description: The configuration file for MSP43FR5994.
******************************************************************************/

/* Defines *******************************************************************/
/* The TI-supplied header */
#include <msp430.h>

/* The maximum number of preemption priority levels in the system.
* This parameter must be divisible by the word length - 16 is usually sufficient */
#define RMP_MAX_PREEMPT_PRIO 16
/* The maximum number of slices allowed */
#define RMP_MAX_SLICES 10000
/* The maximum number of semaphore counts allowed */
#define RMP_SEM_MAX_NUM 1000
/* Are we using custom hooks? */
#define RMP_USE_HOOKS RMP_FALSE
/* The stzck size of the init thread */
#define RMP_INIT_STACK_SIZE 128

/* We are using MSP430X */
#define RMP_MSP430_X RMP_TRUE

/* Other low-level initialization stuff - clock and serial */
#define RMP_MSP430_LOW_LEVEL_INIT() \
do \
{ \
/* Stop the WDT */ \
WDTCTL = WDTPW | WDTHOLD; \
} \
while(0)

/* This is for debugging output */
#define RMP_MSP430_PUTCHAR(CHAR) \
do \
{ \
} \
while(0)
/* End Defines ***************************************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/
186 changes: 186 additions & 0 deletions MProkaron/Include/Platform/MSP430/platform_msp430.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/******************************************************************************
Filename : platform_msp430.h
Author : pry
Date : 01/04/2017
Licence : LGPL v3+; see COPYING for details.
Description : The header of "platform_msp430.c".
******************************************************************************/

/* Defines *******************************************************************/
#ifdef __HDR_DEFS__
#ifndef __PLATFORM_MSP430_H_DEFS__
#define __PLATFORM_MSP430_H_DEFS__
/*****************************************************************************/
/* Basic Types ***************************************************************/
#if(DEFINE_BASIC_TYPES==TRUE)

#ifndef __S32__
#define __S32__
typedef signed long s32;
#endif

#ifndef __S16__
#define __S16__
typedef signed int s16;
#endif

#ifndef __S8__
#define __S8__
typedef signed char s8;
#endif

#ifndef __U32__
#define __U32__
typedef unsigned long u32;
#endif

#ifndef __U16__
#define __U16__
typedef unsigned int u16;
#endif

#ifndef __U8__
#define __U8__
typedef unsigned char u8;
#endif

#endif
/* End Basic Types ***********************************************************/

/* Begin Extended Types ******************************************************/
#ifndef __PTR_T__
#define __PTR_T__
/* The typedef for the pointers - This is the raw style. Pointers must be unsigned */
#if(RMP_MSP430_X==RMP_TRUE)
typedef u32 ptr_t;
#else
typedef u16 ptr_t;
#endif
#endif

#ifndef __CNT_T__
#define __CNT_T__
/* The typedef for the count variables */
typedef s16 cnt_t;
#endif

#ifndef __RET_T__
#define __RET_T__
#if(RMP_MSP430_X==RMP_TRUE)
/* The type for return value */
typedef s32 ret_t;
#else
typedef s16 ret_t;
#endif
#endif
/* End Extended Types ********************************************************/

/* System macros *************************************************************/
/* Compiler "extern" keyword setting */
#define EXTERN extern
/* The order of bits in one CPU machine word */
#define RMP_WORD_ORDER 4
/* The maximum length of char printing - no need to change this in most cases */
#define RMP_KERNEL_DEBUG_MAX_STR 128
/* The offset of the stack when initializing */
#define RMP_INIT_STACK RMP_INIT_STACK_TAIL(17)

/* The CPU and application specific macros are here */
#include "platform_msp430_conf.h"
/* End System macros *********************************************************/

/* MSP430 specific macros ****************************************************/

/*****************************************************************************/
/* __PLATFORM_MSP430_H_DEFS__ */
#endif
/* __HDR_DEFS__ */
#endif
/* End Defines ***************************************************************/

/* Structs *******************************************************************/
#ifdef __HDR_STRUCTS__
#ifndef __PLATFORM_MSP430_H_STRUCTS__
#define __PLATFORM_MSP430_H_STRUCTS__
/* We used structs in the header */

/* Use defines in these headers */
#define __HDR_DEFS__
#undef __HDR_DEFS__
/*****************************************************************************/

/*****************************************************************************/
/* __PLATFORM_MSP430_H_STRUCTS__ */
#endif
/* __HDR_STRUCTS__ */
#endif
/* End Structs ***************************************************************/

/* Private Global Variables **************************************************/
#if(!(defined __HDR_DEFS__||defined __HDR_STRUCTS__))
#ifndef __PLATFORM_MSP430_MEMBERS__
#define __PLATFORM_MSP430_MEMBERS__

/* In this way we can use the data structures and definitions in the headers */
#define __HDR_DEFS__

#undef __HDR_DEFS__

#define __HDR_STRUCTS__

#undef __HDR_STRUCTS__

/* If the header is not used in the public mode */
#ifndef __HDR_PUBLIC_MEMBERS__
/*****************************************************************************/

/*****************************************************************************/
/* End Private Global Variables **********************************************/

/* Private C Function Prototypes *********************************************/
/*****************************************************************************/

/*****************************************************************************/
#define __EXTERN__
/* End Private C Function Prototypes *****************************************/

/* Public Global Variables ***************************************************/
/* __HDR_PUBLIC_MEMBERS__ */
#else
#define __EXTERN__ EXTERN
/* __HDR_PUBLIC_MEMBERS__ */
#endif

/*****************************************************************************/

/*****************************************************************************/

/* End Public Global Variables ***********************************************/

/* Public C Function Prototypes **********************************************/
/*****************************************************************************/
/* Interrupts */
EXTERN void RMP_Disable_Int(void);
EXTERN void RMP_Enable_Int(void);

__EXTERN__ ptr_t RMP_MSB_Get(ptr_t Val);
EXTERN void _RMP_Start(ptr_t Entry, ptr_t Stack);
EXTERN void _RMP_Yield(void);

/* Initialization */
__EXTERN__ void _RMP_Stack_Init(ptr_t Entry, ptr_t Stack, ptr_t Arg);
__EXTERN__ void _RMP_Low_Level_Init(void);
__EXTERN__ void RMP_Putchar(char Char);
__EXTERN__ void _RMP_Plat_Hook(void);
/*****************************************************************************/
/* Undefine "__EXTERN__" to avoid redefinition */
#undef __EXTERN__
/* __PLATFORM_MSP430_MEMBERS__ */
#endif
/* !(defined __HDR_DEFS__||defined __HDR_STRUCTS__) */
#endif
/* End Public C Function Prototypes ******************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/
15 changes: 15 additions & 0 deletions MProkaron/Include/Platform/MSP430/platform_msp430_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/******************************************************************************
Filename : platform_msp430_conf.h
Author : pry
Date : 24/06/2017
Licence : LGPL v3+; see COPYING for details.
Description: The configuration file for MSP430 MCUs.
******************************************************************************/

/* Config Includes ***********************************************************/
#include "Platform/MSP430/Chips/MSP430FR5994/platform_MSP430FR5994.h"
/* End Config Includes *******************************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/
2 changes: 1 addition & 1 deletion MProkaron/Include/Platform/RMP_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description : The platform specific types for RMP.
******************************************************************************/

/* Platform Includes *********************************************************/
#include "Platform/MIPSM/platform_mipsm.h"
#include "Platform/MSP430/platform_msp430.h"
/* End Platform Includes *****************************************************/

/* End Of File ***************************************************************/
Expand Down
4 changes: 3 additions & 1 deletion MProkaron/Platform/CortexM/platform_cmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ Description : The platform specific file for Cortex-M.
/* Begin Function:_RMP_Stack_Init *********************************************
Description : Initiate the process stack when trying to start a process. Never
call this function in user application.
Input : pid_t PID - The PID of the process.
Input : ptr_t Entry - The entry of the thread.
ptr_t Stack - The stack address of the thread.
ptr_t Arg - The argument to pass to the thread.
Output : None.
Return : None.
Other : When the system stack safe redundancy is set to zero, the stack
Expand Down
Loading

0 comments on commit 1801dbc

Please sign in to comment.