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