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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [MB91460_Softune/] [SRC/] [watchdog/] [watchdog.c] - Blame information for rev 584

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
  watchdog.c
7
  - This file contains the function deefinition for hardware watchdog.
8
-------------------------------------------------------------------------*/
9
 
10
#include "mb91467d.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
        HWWDE_ED = WTC_PER_2_16;        /* Set the watchdog period as 655.36 ms */
22
}
23
#endif
24
 
25
/*---------------------------------------------------------------------------
26
 * The below task clears the watchdog and blocks itself for WTC_CLR_PER ticks.
27
 *---------------------------------------------------------------------------*/
28
#if WATCHDOG == WTC_IN_TASK     
29
static void prvWatchdogTask     ( void *pvParameters )
30
{
31
        const portTickType xFrequency = WTC_CLR_PER;
32
        portTickType xLastWakeTime;
33
 
34
        /* Get currrent tick count */
35
        xLastWakeTime = xTaskGetTickCount();
36
 
37
        for( ; ; )
38
        {
39
                Kick_Watchdog();
40
 
41
                /* Block the task for WTC_CLR_PER ticks (300 ms) at watchdog overflow
42
                period of WTC_PER_2_16 CLKRC cycles (655.36 ms) */
43
                vTaskDelayUntil( &xLastWakeTime, xFrequency );
44
        }
45
}
46
#endif
47
 
48
/*---------------------------------------------------------------------------
49
 * The below function creates hardware watchdog task.
50
 *---------------------------------------------------------------------------*/
51
#if WATCHDOG == WTC_IN_TASK     
52
void vStartWatchdogTask( unsigned portSHORT uxPriority )
53
{
54
        xTaskCreate( prvWatchdogTask , ( signed portCHAR * ) "KickWTC",   portMINIMAL_STACK_SIZE, ( void * ) NULL, uxPriority, ( xTaskHandle * ) NULL );
55
}
56
#endif

powered by: WebSVN 2.1.0

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