Ignore:
Timestamp:
Jul 3, 2020, 7:19:17 PM (4 years ago)
Author:
coas-nagasima
Message:

ASP3, TINET, mbed を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_timer.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5151#define TOPPERS_CHIP_TIMER_H
    5252
     53#include "kernel/kernel_impl.h"
    5354#include <sil.h>
    5455#include "rza1.h"
     
    140141 *  生させるように設定する.
    141142 */
    142 extern void target_hrt_set_event(HRTCNT hrtcnt);
     143Inline void
     144target_hrt_set_event(HRTCNT hrtcnt)
     145{
     146        uint32_t        cnt = hrtcnt * 33 + hrtcnt / 3 + 1;
     147        uint32_t        current;
     148
     149        /*
     150         *  現在のカウント値を読み,hrtcnt後に割込みが発生するように設定する.
     151         */
     152        current = sil_rew_mem(OSTM_CNT(OSTM0_BASE));
     153        sil_wrw_mem(OSTM_CMP(OSTM0_BASE), current + cnt);
     154
     155        /*
     156         *  上で現在のカウント値を読んで以降に,cnt以上カウントアップしてい
     157         *  た場合には,割込みを発生させる.
     158         */
     159        if (sil_rew_mem(OSTM_CNT(OSTM0_BASE)) - current >= cnt) {
     160                raise_int(INTNO_OSTM0);
     161        }
     162}
    143163
    144164/*
    145165 *  高分解能タイマ割込みの要求
    146166 */
    147 extern  void target_hrt_raise_event(void);
     167Inline void
     168target_hrt_raise_event(void)
     169{
     170        raise_int(INTNO_OSTM0);
     171}
    148172
    149173/*
     
    184208 *  オーバランタイマの停止
    185209 */
    186 extern PRCTIM target_ovrtimer_stop(void);
     210Inline PRCTIM
     211target_ovrtimer_stop(void)
     212{
     213        uint32_t        cnt;
     214
     215        /*
     216         *  OSタイマを停止する.
     217         */
     218        sil_wrb_mem(OSTM_TT(OSTM1_BASE), OSTM_TT_STOP);
     219
     220        if (probe_int(INTNO_OSTM1)) {
     221                /*
     222                 *  割込み要求が発生している場合
     223                 */
     224                clear_int(INTNO_OSTM1);
     225                return(0U);
     226        }
     227        else {
     228                cnt = sil_rew_mem(OSTM_CNT(OSTM1_BASE));
     229                return((PRCTIM)((cnt + 34) / 5 * 3 / 20));
     230        }
     231}
    187232
    188233/*
    189234 *  オーバランタイマの現在値の読出し
    190235 */
    191 extern PRCTIM target_ovrtimer_get_current(void);
     236Inline PRCTIM
     237target_ovrtimer_get_current(void)
     238{
     239        uint32_t        cnt;
     240
     241        if (probe_int(INTNO_OSTM1)) {
     242                /*
     243                 *  割込み要求が発生している場合
     244                 */
     245                return(0U);
     246        }
     247        else {
     248                cnt = sil_rew_mem(OSTM_CNT(OSTM1_BASE));
     249                return((PRCTIM)((cnt + 34) / 5 * 3 / 20));
     250        }
     251}
    192252
    193253/*
Note: See TracChangeset for help on using the changeset viewer.