123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- /*----------------------------------------------------------------------------
- * RL-ARM - RTX
- *----------------------------------------------------------------------------
- * Name: RTX_CONFIG.C
- * Purpose: Configuration of RTX Kernel for Cortex-M
- * Rev.: V4.20
- *----------------------------------------------------------------------------
- * This code is part of the RealView Run-Time Library.
- * Copyright (c) 2004-2011 KEIL - An ARM Company. All rights reserved.
- *---------------------------------------------------------------------------*/
- #include "includes.h"
- #include <RTL.h>
- #include "userSys.h"
- /*----------------------------------------------------------------------------
- * RTX User configuration part BEGIN
- *---------------------------------------------------------------------------*/
- //-------- <<< Use Configuration Wizard in Context Menu >>> -----------------
- //
- // <h>Task Configuration
- // =====================
- //
- // <o>Number of concurrent running tasks <0-250>
- // <i> Define max. number of tasks that will run at the same time.
- // <i> Default: 6
- #ifndef OS_TASKCNT
- #define OS_TASKCNT 8
- #endif
- // <o>Number of tasks with user-provided stack <0-250>
- // <i> Define the number of tasks that will use a bigger stack.
- // <i> The memory space for the stack is provided by the user.
- // <i> Default: 0
- #ifndef OS_PRIVCNT
- #define OS_PRIVCNT 0
- #endif
- // <o>Task stack size [bytes] <20-4096:8><#/4>
- // <i> Set the stack size for tasks which is assigned by the system.
- // <i> Default: 200
- #ifndef OS_STKSIZE
- #define OS_STKSIZE 50
- #endif
- // <q>Check for the stack overflow
- // ===============================
- // <i> Include the stack checking code for a stack overflow.
- // <i> Note that additional code reduces the Kernel performance.
- #ifndef OS_STKCHECK
- #define OS_STKCHECK 1
- #endif
- // <q>Run in privileged mode
- // =========================
- // <i> Run all Tasks in privileged mode.
- // <i> Default: Unprivileged
- #ifndef OS_RUNPRIV
- #define OS_RUNPRIV 1 ///
- #endif
- // </h>
- // <h>SysTick Timer Configuration
- // =============================
- // <o>Timer clock value [Hz] <1-1000000000>
- // <i> Set the timer clock value for selected timer.
- // <i> Default: 6000000 (6MHz)
- #ifndef OS_CLOCK
- #define OS_CLOCK USER_MAIN_SYSCLK
- #endif
- // <o>Timer tick value [us] <1-1000000>
- // <i> Set the timer tick value for selected timer.
- // <i> Default: 10000 (10ms)
- #ifndef OS_TICK
- #define OS_TICK 10000
- #endif
- // </h>
- // <h>System Configuration
- // =======================
- // <e>Round-Robin Task switching
- // =============================
- // <i> Enable Round-Robin Task switching.
- #ifndef OS_ROBIN
- #define OS_ROBIN 1
- #endif
- // <o>Round-Robin Timeout [ticks] <1-1000>
- // <i> Define how long a task will execute before a task switch.
- // <i> Default: 5
- #ifndef OS_ROBINTOUT
- #define OS_ROBINTOUT 5
- #endif
- // </e>
- // <o>Number of user timers <0-250>
- // <i> Define max. number of user timers that will run at the same time.
- // <i> Default: 0 (User timers disabled)
- #ifndef OS_TIMERCNT
- #define OS_TIMERCNT 5
- #endif
- // <o>ISR FIFO Queue size<4=> 4 entries <8=> 8 entries
- // <12=> 12 entries <16=> 16 entries
- // <24=> 24 entries <32=> 32 entries
- // <48=> 48 entries <64=> 64 entries
- // <96=> 96 entries
- // <i> ISR functions store requests to this buffer,
- // <i> when they are called from the iterrupt handler.
- // <i> Default: 16 entries
- #ifndef OS_FIFOSZ
- #define OS_FIFOSZ 16
- #endif
- // </h>
- //------------- <<< end of configuration section >>> -----------------------
- // Standard library system mutexes
- // ===============================
- // Define max. number system mutexes that are used to protect
- // the arm standard runtime library. For microlib they are not used.
- #ifndef OS_MUTEXCNT
- #define OS_MUTEXCNT 8
- #endif
- /*----------------------------------------------------------------------------
- * RTX User configuration part END
- *---------------------------------------------------------------------------*/
- #define OS_TRV ((U32)(((double)OS_CLOCK*(double)OS_TICK)/1E6)-1)
- /*----------------------------------------------------------------------------
- * Global Functions
- *---------------------------------------------------------------------------*/
- /*--------------------------- os_idle_demon ---------------------------------*/
- __task void os_idle_demon (void) {
- /* The idle demon is a system task, running when no other task is ready */
- /* to run. The 'os_xxx' function calls are not allowed from this task. */
- //printf("os_idle_demon\r\n");
- for (;;) {
- /* HERE: include optional user code to be executed when no task runs.*/
-
- }
- }
- /*--------------------------- os_tmr_call -----------------------------------*/
- void os_tmr_call (U16 info) {
- /* This function is called when the user timer has expired. Parameter */
- /* 'info' holds the value, defined when the timer was created. */
- /* HERE: include optional user code to be executed on timeout. */
- //printf("os_tmr");
- if(info==TMR_INF_BEEP)
- {
- TIM_Cmd(TIM5, DISABLE); //禁止/使能TIM4
- if(!g_ucModemTaskEn) return; //GT打开喇叭
- if(sutPocStatus.Speaker==0&&sutPocStatus.TTS==0){
- SpeakerDisable();
- }
- }else if(info==TMR_INF_MIC)
- {
- MicEnable();
- }else if(info==TMR_INF_RING){//铃音定时器
- if(sutRing.start==0){
- TIM_Cmd(TIM5, DISABLE); //禁止/使能TIM4
- SpeakerDisable();
- }else if(++sutRing.handle>=sutRing.ElementNum){
- sutRing.start=0;
- TIM_Cmd(TIM5, DISABLE); //禁止/使能TIM4
- SpeakerDisable();
- }else{
- sutRing.pElement++;
- SetRingFreq(sutRing.pElement->freq);
- os_tmr_create(sutRing.pElement->time,TMR_INF_RING);
- }
- }
-
- }
- /*--------------------------- os_error --------------------------------------*/
- void os_error (U32 err_code) {
- /* This function is called when a runtime error is detected. Parameter */
- /* 'err_code' holds the runtime error code (defined in RTL.H). */
-
- /* HERE: include optional code to be executed on runtime error. */
- printf("\r\n[OS_Err %d]F=%d,L=%d",err_code,g_usFileID,g_ulFileLine);
- for (;;);
- }
- /*----------------------------------------------------------------------------
- * RTX Configuration Functions
- *---------------------------------------------------------------------------*/
- #include <RTX_lib.c>
- /*----------------------------------------------------------------------------
- * end of file
- *---------------------------------------------------------------------------*/
|