OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [MB96340_Softune/] [FreeRTOS_96348hs_SK16FX100PMC/] [Src/] [watchdog/] [watchdog.c] - Blame information for rev 595

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 584 jeremybenn
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
2
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
3
/* ELIGIBILITY FOR ANY PURPOSES.                                             */
4
/*                 (C) Fujitsu Microelectronics Europe GmbH                  */
5
 
6
/*------------------------------------------------------------------------
7
  watchdog.c
8
  - This file contains the function deefinition for hardware watchdog.
9
-------------------------------------------------------------------------*/
10
#include "mb96348hs.h"
11
#include "FreeRTOS.h"
12
#include "task.h"
13
#include "watchdog.h"
14
 
15
/*---------------------------------------------------------------------------
16
 * Setup Watchdog
17
 *---------------------------------------------------------------------------*/
18
#if WATCHDOG != WTC_NONE
19
void InitWatchdog( void )
20
{
21
        WDTC_WTI = WTC_PER_2_23;        /* 2^23/CLKWT */
22
        WDTC_WTCS = WTC_CLKMC;          /* CLKWT=CLKMC, Watchdog expiration delay = 2.097s @ 4MHZ CLKMC*/
23
        WDTCP = 0x00;                           /* Activate Watchdog, Clear Pattern 0x00 */
24
}
25
 
26
#endif
27
 
28
/*---------------------------------------------------------------------------
29
 * The below task clears the watchdog and blocks itself for WTC_CLR_PER ticks.
30
 *---------------------------------------------------------------------------*/
31
#if WATCHDOG == WTC_IN_TASK
32
static void prvWatchdogTask( void *pvParameters )
33
{
34
        const portTickType      xFrequency = WTC_CLR_PER;
35
        portTickType            xLastWakeTime;
36
        ( void ) pvParameters;
37
 
38
        /* Get currrent tick count */
39
        xLastWakeTime = xTaskGetTickCount();
40
 
41
        for( ;; )
42
        {
43
                /* Get currrent tick count */
44
                xLastWakeTime = xTaskGetTickCount();
45
 
46
                Kick_Watchdog();
47
 
48
                /* Block the task for WTC_CLR_PER ticks (1s) at watchdog overflow period of WTC_PER_2_23 CLKMC cycles */
49
                vTaskDelayUntil( &xLastWakeTime, xFrequency );
50
        }
51
}
52
 
53
#endif
54
 
55
/*---------------------------------------------------------------------------
56
 * The below function creates hardware watchdog task.
57
 *---------------------------------------------------------------------------*/
58
#if WATCHDOG == WTC_IN_TASK
59
void vStartWatchdogTask( unsigned portBASE_TYPE uxPriority )
60
{
61
        xTaskCreate( prvWatchdogTask, (signed portCHAR *) "KickWTC", portMINIMAL_STACK_SIZE, ( void * ) NULL, uxPriority, ( xTaskHandle * ) NULL );
62
}
63
 
64
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.