1;/***************************************************************************
2; * Copyright (c) 2024 Microsoft Corporation
3; *
4; * This program and the accompanying materials are made available under the
5; * terms of the MIT License which is available at
6; * https://opensource.org/licenses/MIT.
7; *
8; * SPDX-License-Identifier: MIT
9; **************************************************************************/
10;
11;
12;/**************************************************************************/
13;/**************************************************************************/
14;/**                                                                       */
15;/** ThreadX Component                                                     */
16;/**                                                                       */
17;/**   Initialize                                                          */
18;/**                                                                       */
19;/**************************************************************************/
20;/**************************************************************************/
21;
22
23    .text
24
25;
26;/**************************************************************************/
27;/*                                                                        */
28;/*  FUNCTION                                               RELEASE        */
29;/*                                                                        */
30;/*    _tx_initialize_low_level                             RXv2/GNURX     */
31;/*                                                           6.1.11       */
32;/*  AUTHOR                                                                */
33;/*                                                                        */
34;/*    William E. Lamie, Microsoft Corporation                             */
35;/*                                                                        */
36;/*  DESCRIPTION                                                           */
37;/*                                                                        */
38;/*    This function is responsible for any low-level processor            */
39;/*    initialization, including setting up interrupt vectors, setting     */
40;/*    up a periodic timer interrupt source, saving the system stack       */
41;/*    pointer for use in ISR processing later, and finding the first      */
42;/*    available RAM memory address for tx_application_define.             */
43;/*                                                                        */
44;/*  INPUT                                                                 */
45;/*                                                                        */
46;/*    None                                                                */
47;/*                                                                        */
48;/*  OUTPUT                                                                */
49;/*                                                                        */
50;/*    None                                                                */
51;/*                                                                        */
52;/*  CALLS                                                                 */
53;/*                                                                        */
54;/*    None                                                                */
55;/*                                                                        */
56;/*  CALLED BY                                                             */
57;/*                                                                        */
58;/*    _tx_initialize_kernel_enter           ThreadX entry function        */
59;/*                                                                        */
60;/*  RELEASE HISTORY                                                       */
61;/*                                                                        */
62;/*    DATE              NAME                      DESCRIPTION             */
63;/*                                                                        */
64;/*  12-30-2020     William E. Lamie         Initial Version 6.1.3         */
65;/*  10-15-2021     William E. Lamie         Modified comment(s),          */
66;/*                                            resulting in version 6.1.9  */
67;/*  01-31-2022     William E. Lamie         Modified comment(s),          */
68;/*                                            resulting in version 6.1.10 */
69;/*  04-25-2022     William E. Lamie         Modified comment(s),          */
70;/*                                            resulting in version 6.1.11 */
71;/*                                                                        */
72;/**************************************************************************/
73    .global __tx_initialize_low_level
74__tx_initialize_low_level:
75
76;
77;    /* Save the first available memory address.  */
78;    _tx_initialize_unused_memory =  (VOID_PTR) &free_mem_start;
79;
80    MOV.L    #_end, R1                ; Pickup unused memory address
81    MOV.L    #__tx_initialize_unused_memory, R2
82    MOV.L    R1,[R2]                            ; Save first free memory address
83
84;   /* Set priority of SWINT to 1. */
85    MOV.L    #0x87303, r1
86    MOV.L    #1, r2
87    MOV.B    r2, [r1]
88
89;   /* Enable SWINT. */
90    MOV.L    #0x87203,r1
91    MOV.B    [r1], r2
92    OR       #(1 << 3), r2
93    MOV.B    r2, [r1]
94
95    RTS
96
97    .end
98