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    .GLB __tx_initialize_unused_memory
25
26    IPR03    .EQU  87303H
27    IEN03    .EQU  87203H
28
29    .SECTION P,CODE
30
31;
32;/**************************************************************************/
33;/*                                                                        */
34;/*  FUNCTION                                               RELEASE        */
35;/*                                                                        */
36;/*    _tx_initialize_low_level                             RXv3/CCRX      */
37;/*                                                           6.1.11       */
38;/*  AUTHOR                                                                */
39;/*                                                                        */
40;/*    William E. Lamie, Microsoft Corporation                             */
41;/*                                                                        */
42;/*  DESCRIPTION                                                           */
43;/*                                                                        */
44;/*    This function is responsible for any low-level processor            */
45;/*    initialization, including setting up interrupt vectors, setting     */
46;/*    up a periodic timer interrupt source, saving the system stack       */
47;/*    pointer for use in ISR processing later, and finding the first      */
48;/*    available RAM memory address for tx_application_define.             */
49;/*                                                                        */
50;/*  INPUT                                                                 */
51;/*                                                                        */
52;/*    None                                                                */
53;/*                                                                        */
54;/*  OUTPUT                                                                */
55;/*                                                                        */
56;/*    None                                                                */
57;/*                                                                        */
58;/*  CALLS                                                                 */
59;/*                                                                        */
60;/*    None                                                                */
61;/*                                                                        */
62;/*  CALLED BY                                                             */
63;/*                                                                        */
64;/*    _tx_initialize_kernel_enter           ThreadX entry function        */
65;/*                                                                        */
66;/*  RELEASE HISTORY                                                       */
67;/*                                                                        */
68;/*    DATE              NAME                      DESCRIPTION             */
69;/*                                                                        */
70;/*  06-02-2021     William E. Lamie         Initial Version 6.1.7         */
71;/*  10-15-2021     William E. Lamie         Modified comment(s),          */
72;/*                                            resulting in version 6.1.9  */
73;/*  01-31-2022     William E. Lamie         Modified comment(s),          */
74;/*                                            resulting in version 6.1.10 */
75;/*  04-25-2022     William E. Lamie         Modified comment(s),          */
76;/*                                            resulting in version 6.1.11 */
77;/*                                                                        */
78;/**************************************************************************/
79
80    .GLB __tx_initialize_low_level
81__tx_initialize_low_level:
82;
83;    /* Save the first available memory address.  */
84;    _tx_initialize_unused_memory =  (VOID_PTR) &free_mem_start;
85;
86    MOV.L    #free_mem_start, R1                ; Pickup unused memory address
87    MOV.L    #__tx_initialize_unused_memory,R2
88    MOV.L    R1,[R2]                            ; Save first free memory address
89
90;   /* Set priority of SWINT to 1. */
91    MOV.L    #IPR03, r1
92    MOV.L    #1, r2
93    MOV.B    r2, [r1]
94
95;   /* Enable SWINT. */
96    MOV.L    #IEN03,r1
97    MOV.B    [r1], r2
98    OR       #(1 << 3), r2
99    MOV.B    r2, [r1]
100
101    RTS
102
103    .SECTION    FREEMEM ,DATA, ALIGN=4
104free_mem_start:
105    .BLKL 8              ; this section is last in the link map so we can access the end of RAM memory
106
107    .END
108
109