aboutsummaryrefslogtreecommitdiffstats
path: root/demos/STM32/RT-STM32F401C-DISCOVERY/main.c
blob: 0c8fd5d07fc801b5f187fc3d844310d2a055656d (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

#include "ch.h"
#include "hal.h"
#include "rt_test_root.h"
#include "oslib_test_root.h"

/*
 * This is a periodic thread that does absolutely nothing except flashing
 * a LED.
 */
static THD_WORKING_AREA(waThread1, 128);
static THD_FUNCTION(Thread1, arg) {

  (void)arg;
  chRegSetThreadName("blinker");
  while (true) {
    palSetPad(GPIOD, GPIOD_LED3);       /* Orange.  */
    chThdSleepMilliseconds(500);
    palClearPad(GPIOD, GPIOD_LED3);     /* Orange.  */
    chThdSleepMilliseconds(500);
  }
}

/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Activates the serial driver 2 using the driver default configuration.
   * PA2(TX) and PA3(RX) are routed to USART2.
   */
  sdStart(&SD2, NULL);
  palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));
  palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7));

  /*
   * Creates the example thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    if (palReadPad(GPIOA, GPIOA_BUTTON)) {
      test_execute((BaseSequentialStream *)&SD2, &rt_test_suite);
      test_execute((BaseSequentialStream *)&SD2, &oslib_test_suite);
    }
    chThdSleepMilliseconds(500);
  }
}
/span> - Add a .proc directive for the ia64_aio_raw_syscall macro. This sounds a lot like the previous entry, but that one fixed the __ia64_raw_syscall macro, located in syscall-ia64.h. This macro is in raw_syscall.c, which pretty much only exists for ia64. This bug prevented the package from building with newer version of gcc. * Mon Aug 1 2005 Jeff Moyer <jmoyer@redhat.com> - 0.3.105-1 - Add a .proc directive for the ia64 raw syscall macro. * Fri Apr 1 2005 Jeff Moyer <jmoyer@redhat.com> - 0.3.104-1 - Add Alpha architecture support. (Sergey Tikhonov <tsv@solvo.ru>) * Tue Jan 25 2005 Jeff Moyer <jmoyer@redhat.com> - 0.3.103-1 - Fix SONAME breakage. In changing file names around, I also changed the SONAME, which is a no no. * Thu Oct 14 2004 Jeff Moyer <jmoyer@redhat.com> - 0.3.102-1 - S390 asm had a bug; I forgot to update the clobber list. Lucky for me, newer compilers complain about such things. - Also update the s390 asm to look more like the new kernel variants. * Wed Oct 13 2004 Jeff Moyer <jmoyer@redhat.com> - 0.3.101-1 - Revert syscall return values to be -ERRNO. This was an inadvertant bug introduced when clobber lists changed. - add ppc64pseries and ppc64iseries to exclusivearch * Tue Sep 14 2004 Jeff Moyer <jmoyer@redhat.com> - 0.3.100-1 - Switch around the tests for _PPC_ and _powerpc64_ so that the ppc64 platforms get the right padding. * Wed Jul 14 2004 Jeff Moyer <jmoyer@redhat.com> - 0.3.99-4 - Ok, there was a race in moving the cvs module. Someone rebuild from the old cvs into fc3. *sigh* bumping rev. * Wed Jul 14 2004 Jeff Moyer <jmoyer@redhat.com> - 0.3.99-3 - Actually provide libaio.so.1. * Tue Mar 30 2004 Jeff Moyer <jmoyer@redhat.com> - 0.3.99-2 - Apparently the 0.3.93 patch was not meant for 0.3.96. Backed it out. * Tue Mar 30 2004 Jeff Moyer <jmoyer@redhat.com> - 0.3.99-1 - Fix compat calls. - make library .so.1.0.0 and make symlinks properly. - Fix header file for inclusion in c++ code. * Thu Feb 26 2004 Jeff Moyer <jmoyer@redhat.com> 0.3.98-2 - bah. fix version nr in changelog. * Thu Feb 26 2004 Jeff Moyer <jmoyer@redhat.com> 0.3.98-1 - fix compiler warnings. * Thu Feb 26 2004 Jeff Moyer <jmoyer@redhat.com> 0.3.97-2 - make srpm was using rpm to do a build. changed that to use rpmbuild if it exists, and fallback to rpm if it doesn't. * Tue Feb 24 2004 Jeff Moyer <jmoyer@redhat.com> 0.3.97-1 - Use libc syscall(2) instead of rolling our own calling mechanism. This change is inspired due to a failure to build with newer gcc, since clobber lists were wrong. - Add -fpic to the CFLAGS for all architectures. Should address bz #109457. - change a #include from <linux/types.h> to <sys/types.h>. Fixes a build issue on s390. * Wed Jul 7 2003 Bill Nottingham <notting@redhat.com> 0.3.96-3 - fix paths on lib64 arches * Wed Jun 18 2003 Michael K. Johnson <johnsonm@redhat.com> 0.3.96-2 - optimization in io_getevents from Arjan van de Ven in 0.3.96-1 - deal with ia64 in 0.3.96-2 * Wed May 28 2003 Michael K. Johnson <johnsonm@redhat.com> 0.3.95-1 - ppc bugfix from Julie DeWandel * Tue May 20 2003 Michael K. Johnson <johnsonm@redhat.com> 0.3.94-1 - symbol versioning fix from Ulrich Drepper * Mon Jan 27 2003 Benjamin LaHaise <bcrl@redhat.com> - bump to 0.3.93-3 for rebuild. * Mon Dec 16 2002 Benjamin LaHaise <bcrl@redhat.com> - libaio 0.3.93 test release - add powerpc support from Gianni Tedesco <gianni@ecsc.co.uk> - add s/390 support from Arnd Bergmann <arnd@bergmann-dalldorf.de> * Fri Sep 12 2002 Benjamin LaHaise <bcrl@redhat.com> - libaio 0.3.92 test release - build on x86-64 * Thu Sep 12 2002 Benjamin LaHaise <bcrl@redhat.com> - libaio 0.3.91 test release - build on ia64 - remove libredhat-kernel from the .spec file * Thu Sep 5 2002 Benjamin LaHaise <bcrl@redhat.com> - libaio 0.3.90 test release * Mon Apr 29 2002 Benjamin LaHaise <bcrl@redhat.com> - add requires initscripts >= 6.47-1 to get boot time libredhat-kernel linkage correct. - typo fix * Thu Apr 25 2002 Benjamin LaHaise <bcrl@redhat.com> - make /usr/lib/libredhat-kernel.so point to /lib/libredhat-kernel.so.1.0.0 * Mon Apr 15 2002 Tim Powers <timp@redhat.com> - make the post scriptlet not use /bin/sh * Sat Apr 12 2002 Benjamin LaHaise <bcrl@redhat.com> - add /lib/libredhat-kernel* to %files. * Fri Apr 12 2002 Benjamin LaHaise <bcrl@redhat.com> - make the dummy install as /lib/libredhat-kernel.so.1.0.0 so that ldconfig will link against it if no other is installed. * Tue Jan 22 2002 Benjamin LaHaise <bcrl@redhat.com> - add io_getevents * Tue Jan 22 2002 Michael K. Johnson <johnsonm@redhat.com> - Make linker happy with /usr/lib symlink for libredhat-kernel.so * Mon Jan 21 2002 Michael K. Johnson <johnsonm@redhat.com> - Added stub library * Sun Jan 20 2002 Michael K. Johnson <johnsonm@redhat.com> - Initial packaging