1 Remove duplicated files to stop the linker from complaining about duplicate
4 Signed-off-by: Alexandre Belloni <abelloni@adeneo-embedded.com>
6 --- a/csps/lpc32xx/bsps/fdi3250/startup/examples/s1l/sysapi_timer.c 2011-10-05 19:10:37.000000000 +0200
7 +++ /dev/null 2012-01-01 16:39:47.918907000 +0100
9 -/***********************************************************************
10 - * $Id:: sysapi_timer.c 3394 2010-05-06 17:56:27Z usb10132 $
12 - * Project: Time support functions
15 - * Implements the following functions required for the S1L API
23 - ***********************************************************************
24 - * Software that is described herein is for illustrative purposes only
25 - * which provides customers with programming information regarding the
26 - * products. This software is supplied "AS IS" without any warranties.
27 - * NXP Semiconductors assumes no responsibility or liability for the
28 - * use of the software, conveys no license or title under any patent,
29 - * copyright, or mask work right to the product. NXP Semiconductors
30 - * reserves the right to make changes in the software without
31 - * notification. NXP Semiconductors also make no representation or
32 - * warranty that such application will be suitable for the specified
33 - * use without further testing or modification.
34 - **********************************************************************/
36 -#include "s1l_sys_inf.h"
37 -#include "lpc32xx_intc_driver.h"
38 -#include "lpc32xx_timer_driver.h"
40 -static UNS_64 base_rate;
41 -static INT_32 tdev = 0;
43 -/***********************************************************************
45 - * Function: time_init
47 - * Purpose: Initializes time system
49 - * Processing: Initializes the system timer.
55 - * Returns: 0 if the init failed, otherwise non-zero
59 - **********************************************************************/
60 -INT_32 time_init(void)
62 - TMR_PSCALE_SETUP_T pscale;
64 - /* Open timer driver */
67 - tdev = timer_open((void *) TIMER_CNTR0, 0);
70 - /* Use a prescale count to 100000 */
71 - pscale.ps_tick_val = 100000;
72 - pscale.ps_us_val = 0; /* Not needed when ps_tick_val != 0 */
73 - timer_ioctl(tdev, TMR_SETUP_PSCALE, (INT_32) &pscale);
75 - /* Get timer clock rate */
76 - base_rate = (UNS_64) timer_ioctl(tdev, TMR_GET_STATUS,
84 -/***********************************************************************
86 - * Function: time_reset
88 - * Purpose: Resets system timer
101 - **********************************************************************/
102 -void time_reset(void)
106 - timer_ioctl(tdev, TMR_RESET, 1);
110 -/***********************************************************************
112 - * Function: time_start
114 - * Purpose: Starts system timer
127 - **********************************************************************/
128 -void time_start(void)
132 - timer_ioctl(tdev, TMR_ENABLE, 1);
136 -/***********************************************************************
138 - * Function: time_stop
140 - * Purpose: Stops system timer
153 - **********************************************************************/
154 -void time_stop(void)
158 - timer_ioctl(tdev, TMR_ENABLE, 0);
162 -/***********************************************************************
164 - * Function: time_get
166 - * Purpose: Returns current system time value
175 - * Returns: The number of ticks of the timer counter
179 - **********************************************************************/
180 -UNS_64 time_get(void)
182 - TMR_COUNTS_T tcounts;
187 - timer_ioctl(tdev, TMR_GET_COUNTS, (INT_32) &tcounts);
189 - /* Compute number of timer ticks */
190 - ticks = (UNS_64) tcounts.count_val * 100000;
191 - ticks = ticks + (UNS_64) tcounts.ps_count_val;
197 -/***********************************************************************
199 - * Function: time_get_rate
202 - * Returns base tick rate (ticks per second) of the time counter
211 - * Returns: The timer tick rate (in ticks per second)
215 - **********************************************************************/
216 -UNS_64 time_get_rate(void)
221 --- a/csps/lpc32xx/bsps/fdi3250/startup/examples/s1l/sys_mmu_cmd_group.c 2011-10-05 19:10:37.000000000 +0200
222 +++ /dev/null 2012-01-01 16:39:47.918907000 +0100
224 -/***********************************************************************
225 - * $Id:: sys_mmu_cmd_group.c 3430 2010-05-07 17:39:08Z usb10132 $
227 - * Project: Command processor for peek, poke, dump, and fill
230 - * Processes commands from the command prompt
232 - ***********************************************************************
233 - * Software that is described herein is for illustrative purposes only
234 - * which provides customers with programming information regarding the
235 - * products. This software is supplied "AS IS" without any warranties.
236 - * NXP Semiconductors assumes no responsibility or liability for the
237 - * use of the software, conveys no license or title under any patent,
238 - * copyright, or mask work right to the product. NXP Semiconductors
239 - * reserves the right to make changes in the software without
240 - * notification. NXP Semiconductors also make no representation or
241 - * warranty that such application will be suitable for the specified
242 - * use without further testing or modification.
243 - **********************************************************************/
245 -#include "lpc_arm922t_cp15_driver.h"
246 -#include "lpc_string.h"
247 -#include "startup.h"
248 -#include "s1l_cmds.h"
249 -#include "s1l_sys_inf.h"
251 -/* dcache command */
252 -BOOL_32 cmd_dcache(void);
253 -static UNS_32 cmd_dcache_plist[] =
255 - (PARSE_TYPE_STR), /* The "dcache" command */
256 - (PARSE_TYPE_DEC | PARSE_TYPE_END)
258 -static CMD_ROUTE_T core_dcache_cmd =
260 - (UNS_8 *) "dcache",
262 - (UNS_8 *) "Enables, disables, or flushes data cache",
263 - (UNS_8 *) "dcache [0(disable), 1(enable), 2(flush)]",
268 -/* icache command */
269 -BOOL_32 cmd_icache(void);
270 -static UNS_32 cmd_icache_plist[] =
272 - (PARSE_TYPE_STR), /* The "icache" command */
273 - (PARSE_TYPE_DEC | PARSE_TYPE_END)
275 -static CMD_ROUTE_T core_icache_cmd =
277 - (UNS_8 *) "icache",
279 - (UNS_8 *) "Enables or disables instruction cache",
280 - (UNS_8 *) "icache [0(disable), 1(enable)]",
286 -BOOL_32 cmd_inval(void);
287 -static UNS_32 cmd_inval_plist[] =
289 - (PARSE_TYPE_STR | PARSE_TYPE_END) /* The "inval" command */
291 -static CMD_ROUTE_T core_inval_cmd =
295 - (UNS_8 *) "Flushes data cache and invalidates instruction cache",
301 -/* mmuenab command */
302 -BOOL_32 cmd_mmuenab(void);
303 -static UNS_32 cmd_mmuenab_plist[] =
305 - (PARSE_TYPE_STR), /* The "mmuenab" command */
306 - (PARSE_TYPE_DEC | PARSE_TYPE_END)
308 -static CMD_ROUTE_T core_mmuenab_cmd =
310 - (UNS_8 *) "mmuenab",
312 - (UNS_8 *) "Enables or disables the MMU",
313 - (UNS_8 *) "mmuenab [0(disable), 1(enable)]",
319 -BOOL_32 cmd_map(void);
320 -static UNS_32 cmd_map_plist[] =
322 - (PARSE_TYPE_STR), /* The "map" command */
326 - (PARSE_TYPE_DEC | PARSE_TYPE_END),
328 -static CMD_ROUTE_T core_map_cmd =
332 - (UNS_8 *) "Maps a range of physical address sections to virtual addresses",
333 - (UNS_8 *) "map [virt hex addr][phy hex addr][sections][0(uncached), 1(cached), 2(unmap)]",
338 -/* mmuinfo command */
339 -static BOOL_32 cmd_mmuinfo(void);
340 -static UNS_32 cmd_mmuinfo_plist[] =
342 - (PARSE_TYPE_STR | PARSE_TYPE_END) /* The "mmuinfo" command */
344 -static CMD_ROUTE_T core_mmuinfo_cmd =
346 - (UNS_8 *) "mmuinfo",
348 - (UNS_8 *) "Dumps page table and MMU info",
349 - (UNS_8 *) "mmuinfo",
355 -static GROUP_LIST_T mmu_group =
357 - (UNS_8 *) "mmu", /* mmu group */
358 - (UNS_8 *) "MMU command group",
363 -static UNS_8 enabled_msg [] =" enabled";
364 -static UNS_8 disabled_msg [] =" disabled";
365 -static UNS_8 dcache_msg[] = "Data cache";
366 -static UNS_8 icache_msg[] = "Instruction cache";
367 -static UNS_8 pagetab_msg[] = "Page table at address: ";
368 -static UNS_8 slist_msg[] = "Type Virt Phy fl Size";
369 -static UNS_8 mmu_msg [] ="MMU";
370 -static UNS_8 cpage_msg[] = "Coarse page:";
371 -static UNS_8 fpage_msg[] = "Fine page :";
372 -static UNS_8 sect_msg[] = "Section :";
373 -static UNS_8 mbytes_msg[] = "M";
374 -static UNS_8 map1_err_msg[] =
375 - "Error : section addresses must be aligned on a 32-bit boundary";
376 -static UNS_8 map2_err_msg[] =
377 - "Error : Number of sections exceeds address range of device";
378 -static UNS_8 phya_msg[] = "Virtual address ";
379 -static UNS_8 mapped_msg[] = " mapped to physical address ";
380 -static UNS_8 unmapped_msg[] = " unmapped from physical address ";
381 -static UNS_8 cached_msg[] = " (cached)";
382 -static UNS_8 inval_msg[] = " invalidated";
383 -static UNS_8 caches_msg [] ="Caches";
384 -static UNS_8 flushed_msg[] = " flushed";
386 -/***********************************************************************
388 - * Function: show_section
390 - * Purpose: Display section information
396 - * mmu_reg : MMU settings for this section
397 - * virt_addr : Starting virtual address for this section
398 - * segs : Number of 1M segments for this section
406 - **********************************************************************/
407 -static void show_section(UNS_32 mmu_reg,
411 - UNS_8 straddr [16];
414 - if ((mmu_reg & ARM922T_L1D_TYPE_PG_SN_MASK) !=
415 - ARM922T_L1D_TYPE_FAULT)
417 - if ((mmu_reg & ARM922T_L1D_TYPE_PG_SN_MASK) ==
418 - ARM922T_L1D_TYPE_CPAGE)
420 - term_dat_out(cpage_msg);
422 - else if ((mmu_reg & ARM922T_L1D_TYPE_PG_SN_MASK) ==
423 - ARM922T_L1D_TYPE_FPAGE)
425 - term_dat_out(fpage_msg);
429 - term_dat_out(sect_msg);
432 - /* Compute virtual address */
433 - str_makehex(straddr, virt_addr, 8);
434 - term_dat_out(straddr);
435 - term_dat_out((UNS_8 *) " ");
437 - /* Compute mapped physical address */
438 - if ((mmu_reg & ARM922T_L1D_TYPE_PG_SN_MASK) ==
439 - ARM922T_L1D_TYPE_SECTION)
441 - mmu_phy = mmu_reg & 0xFFF00000;
445 - /* Don't compute addresses for non-sections */
448 - str_makehex(straddr, mmu_phy, 8);
449 - term_dat_out(straddr);
450 - term_dat_out((UNS_8 *) " ");
453 - if ((mmu_reg & ARM922T_L1D_BUFFERABLE) != 0)
455 - term_dat_out((UNS_8 *) "b");
459 - term_dat_out((UNS_8 *) " ");
461 - if ((mmu_reg & ARM922T_L1D_CACHEABLE) != 0)
463 - term_dat_out((UNS_8 *) "c");
467 - term_dat_out((UNS_8 *) " ");
469 - term_dat_out((UNS_8 *) " ");
471 - /* Displays used megabytes */
472 - str_makedec(straddr, segs);
473 - term_dat_out(straddr);
474 - term_dat_out_crlf(mbytes_msg);
478 -/***********************************************************************
480 - * Function: mmu_dumpinfo
482 - * Purpose: Display MMU info
485 - * Display the MMU information, including enable status, cache
486 - * status, and page table.
492 - * Returns: TRUE if the command was processed, otherwise FALSE
496 - **********************************************************************/
497 -static BOOL_32 mmu_dumpinfo(void)
499 - UNS_32 segsz, last_mmu_reg, mmu_vrt, mmu_reg, mmu_vrtsav = 0, *pt;
500 - UNS_32 mlast_mmu_reg, mmmu_reg;
502 - UNS_8 hexaddr [16];
504 - term_dat_out(mmu_msg);
505 - if (cp15_mmu_enabled() == FALSE)
507 - term_dat_out_crlf(disabled_msg);
511 - term_dat_out_crlf(enabled_msg);
513 - /* Get MMU control register word */
514 - mmu_reg = cp15_get_mmu_control_reg();
516 - /* Instruction cache status */
517 - term_dat_out(icache_msg);
518 - if ((mmu_reg & ARM922T_MMU_CONTROL_I) == 0)
520 - term_dat_out_crlf(disabled_msg);
524 - term_dat_out_crlf(enabled_msg);
527 - /* Data cache status */
528 - term_dat_out(dcache_msg);
529 - if ((mmu_reg & ARM922T_MMU_CONTROL_C) == 0)
531 - term_dat_out_crlf(disabled_msg);
535 - term_dat_out_crlf(enabled_msg);
538 - term_dat_out(pagetab_msg);
539 - mmu_reg = (UNS_32) cp15_get_ttb();
540 - str_makehex(hexaddr, mmu_reg, 8);
541 - term_dat_out_crlf(hexaddr);
542 - term_dat_out_crlf(slist_msg);
544 - /* Process MMU table - assume that the physical and
545 - virtual locations of table are the same */
546 - pt = (UNS_32 *) mmu_reg;
548 - segsz = 0xFFFFFFFF;
549 - last_mmu_reg = mlast_mmu_reg = 0xFFFFFFFF;
550 - for (idx = 0; idx < 4096; idx++)
553 - mmmu_reg = (mmu_reg & (ARM922T_L1D_TYPE_PG_SN_MASK |
554 - ARM922T_L1D_BUFFERABLE | ARM922T_L1D_CACHEABLE));
557 - if ((last_mmu_reg != 0xFFFFFFFF) &&
558 - (mlast_mmu_reg != mmmu_reg))
560 - show_section(last_mmu_reg, mmu_vrtsav, segsz);
564 - if (mlast_mmu_reg != mmmu_reg)
566 - mmu_vrtsav = mmu_vrt;
567 - last_mmu_reg = mmu_reg;
568 - mlast_mmu_reg = mmmu_reg;
572 - mmu_vrt += 0x00100000;
579 -/***********************************************************************
581 - * Function: mmu_dumpmap
583 - * Purpose: Map a virtual address range to a physical range
586 - * From the input addresses and number of sections, generate the
587 - * appropriate entries in the page table.
593 - * Returns: TRUE if the command was processed, otherwise FALSE
597 - **********************************************************************/
598 -static BOOL_32 mmu_dumpmap(UNS_32 vrt,
603 - BOOL_32 processed = FALSE;
604 - UNS_32 mmu_phy, mmu_vrt, tmp1 = 0, tmp2, *pt;
605 - UNS_8 hexaddr [16];
607 - /* Verify address boundaries are sectional */
608 - mmu_vrt = vrt & ~ARM922T_L2D_SN_BASE_MASK;
609 - mmu_phy = phy & ~ARM922T_L2D_SN_BASE_MASK;
610 - if ((mmu_vrt != 0) || (mmu_phy != 0))
612 - term_dat_out_crlf(map1_err_msg);
616 - /* Verify that address range and section count will not
617 - exceed address range of device */
619 - tmp1 = (tmp1 + sections) - 1;
621 - tmp2 = (tmp2 + sections) - 1;
622 - if ((tmp1 < 4096) && (tmp2 < 4096))
624 - /* Good address range and good section count */
629 - term_dat_out_crlf(map2_err_msg);
633 - /* Generate static part of MMU word */
636 - /* Section mapped with cache disabled */
637 - tmp1 = ARM922T_L1D_TYPE_SECTION;
639 - else if (cache == 1)
641 - /* Section mapped with cache enabled */
642 - tmp1 = (ARM922T_L1D_BUFFERABLE | ARM922T_L1D_CACHEABLE |
643 - ARM922T_L1D_TYPE_SECTION);
645 - else if (cache == 2)
647 - /* Section unmapped */
648 - tmp1 = ARM922T_L1D_TYPE_FAULT;
650 - tmp1 |= ARM922T_L1D_AP_ALL;
652 - /* Offset into page table for virtual address */
653 - tmp2 = (vrt >> 20);
654 - pt = cp15_get_ttb() + tmp2;
656 - /* Loop until all sections are complete */
657 - while ((sections > 0) && (processed == TRUE))
659 - /* Add in physical address */
660 - tmp2 = tmp1 | (phy & ARM922T_L2D_SN_BASE_MASK);
662 - /* Save new section descriptor for virtual address */
665 - /* Output message shown the map */
666 - term_dat_out(phya_msg);
667 - str_makehex(hexaddr, phy, 8);
668 - term_dat_out(hexaddr);
671 - term_dat_out(unmapped_msg);
675 - term_dat_out(mapped_msg);
677 - str_makehex(hexaddr, vrt, 8);
678 - term_dat_out(hexaddr);
681 - term_dat_out(cached_msg);
683 - term_dat_out_crlf((UNS_8 *) "");
685 - /* Next section and page table entry*/
695 -/***********************************************************************
697 - * Function: cmd_mmuinfo
699 - * Purpose: Display MMU information
708 - * Returns: TRUE if the command was processed, otherwise FALSE
712 - **********************************************************************/
713 -static BOOL_32 cmd_mmuinfo(void)
720 -/***********************************************************************
722 - * Function: cmd_map
724 - * Purpose: Map a physical address region to a virtual region
733 - * Returns: TRUE if the command was processed, otherwise FALSE
737 - **********************************************************************/
738 -BOOL_32 cmd_map(void)
740 - UNS_32 phy, virt, sects, ce = 0;
742 - /* Get arguments */
743 - virt = cmd_get_field_val(1);
744 - phy = cmd_get_field_val(2);
745 - sects = cmd_get_field_val(3);
746 - ce = cmd_get_field_val(4);
750 - mmu_dumpmap(virt, phy, sects, ce);
756 -/***********************************************************************
758 - * Function: cmd_inval
760 - * Purpose: MMU cache flush and invalidate
769 - * Returns: TRUE if the command was processed, otherwise FALSE
773 - **********************************************************************/
774 -BOOL_32 cmd_inval(void)
778 - term_dat_out(caches_msg);
779 - term_dat_out(inval_msg);
784 -/***********************************************************************
786 - * Function: cmd_dcache
788 - * Purpose: MMU data cache enable and disable
791 - * If the value passed in the parser is 1, enable the data cache,
792 - * otherwise disable the data cache.
798 - * Returns: TRUE if the command was processed, otherwise FALSE
802 - **********************************************************************/
803 -BOOL_32 cmd_dcache(void)
809 - cenable = cmd_get_field_val(1);
815 - cp15_set_dcache(0);
816 - ppar = disabled_msg;
820 - cp15_invalidate_cache();
821 - cp15_set_dcache(1);
822 - ppar = enabled_msg;
828 - ppar = flushed_msg;
832 - term_dat_out(dcache_msg);
833 - term_dat_out_crlf(ppar);
838 -/***********************************************************************
840 - * Function: cmd_icache
842 - * Purpose: MMU instruction cache enable and disable
845 - * If the value passed in the parser is 1, enable the instruction
846 - * cache, otherwise disable the instruction cache.
852 - * Returns: TRUE if the command was processed, otherwise FALSE
856 - **********************************************************************/
857 -BOOL_32 cmd_icache(void)
863 - cenable = cmd_get_field_val(1);
868 - cp15_invalidate_cache();
869 - cp15_set_icache(1);
870 - ppar = enabled_msg;
874 - cp15_set_icache(0);
875 - ppar = disabled_msg;
878 - term_dat_out(icache_msg);
879 - term_dat_out_crlf(ppar);
885 -/***********************************************************************
887 - * Function: cmd_mmuenab
889 - * Purpose: Enable or disable MMU
898 - * Returns: TRUE if the command was processed, otherwise FALSE
902 - **********************************************************************/
903 -BOOL_32 cmd_mmuenab(void)
908 - term_dat_out_crlf((UNS_8 *) "Warning: Changing MMU status on "
909 - " cached and buffered code can cause system crashes.");
912 - cenable = cmd_get_field_val(1);
916 - if ((cp15_get_mmu_control_reg() & ARM922T_MMU_CONTROL_C) != 0)
918 - cp15_invalidate_cache();
922 - ppar = enabled_msg;
926 - cp15_dcache_flush();
927 - cp15_write_buffer_flush();
928 - cp15_invalidate_cache();
930 - ppar = disabled_msg;
933 - term_dat_out(mmu_msg);
934 - term_dat_out_crlf(ppar);
939 -/***********************************************************************
941 - * Function: mmu_cmd_group_init
943 - * Purpose: Initialize MMU command group
956 - **********************************************************************/
957 -void mmu_cmd_group_init(void)
959 - /* Add MMU group */
960 - cmd_add_group(&mmu_group);
962 - /* Add commands to the MMU group */
963 - cmd_add_new_command(&mmu_group, &core_dcache_cmd);
964 - cmd_add_new_command(&mmu_group, &core_icache_cmd);
965 - cmd_add_new_command(&mmu_group, &core_inval_cmd);
966 - cmd_add_new_command(&mmu_group, &core_mmuenab_cmd);
967 - cmd_add_new_command(&mmu_group, &core_map_cmd);
968 - cmd_add_new_command(&mmu_group, &core_mmuinfo_cmd);