summaryrefslogtreecommitdiff
path: root/ports_smp/win64/vs_2022/src/tx_timer_interrupt.c
blob: 0a19d394e2e51b7a9d15e67aa04c93a11f1f969c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/***************************************************************************
 * Copyright (C) 2026 Eclipse ThreadX contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * AI Disclosure: This file was largely AI-generated by Codex (gpt 5.4).
 * The AI-generated portions may be considered public domain (CC0-1.0)
 * and not subject to the project's licence. The human contributor has
 * reviewed and verified that the code is correct.
 *
 * SPDX-License-Identifier: MIT and CC0-1.0
 **************************************************************************/

#define TX_SOURCE_CODE
#define TX_THREAD_SMP_SOURCE_CODE

#include "tx_api.h"
#include "tx_timer.h"
#include "tx_thread.h"

VOID  _tx_timer_interrupt(VOID)
{
UINT    saved_posture;

    saved_posture =  _tx_thread_smp_protect();

    _tx_timer_interrupt_active++;
    _tx_win32_debug_entry_insert("TIMER INTERRUPT", __FILE__, __LINE__);

    _tx_timer_system_clock++;

    if (*_tx_timer_current_ptr)
    {
        _tx_timer_expired =  TX_TRUE;
    }
    else
    {
        _tx_timer_current_ptr++;
        if (_tx_timer_current_ptr == _tx_timer_list_end)
        {
            _tx_timer_current_ptr =  _tx_timer_list_start;
        }
    }

    if (_tx_timer_expired != TX_FALSE)
    {
        _tx_timer_expiration_process();
    }

    _tx_thread_time_slice();

    _tx_timer_interrupt_active++;
    _tx_thread_smp_unprotect(saved_posture);
}