Manuals / Brands / Computer Equipment / Network Card / Renesas / Computer Equipment / Network Card

Renesas 70 - page 160

1 162
Download 162 pages, 748.4 Kb
Contents
Main Page Preface Requirements for MR308 Use C-compiler package M3T-NC308WA(abbreviated as NC308) for M16C/70,80 M32C/80 series micro- Document List Release Note Page Contents Page Page List of Figures Page List of Tables Page Page Page 2.1 Objective of MR308 Development Page 2.2 Relationship between TRON Specification and MR308 2.3 MR308 Features Page Chapter 3 Introduction to MR308 3.1 Concept of Real-time OS 3.1.1 Why Real-time OS is Necessary Page Page 3.1.2 Operating Principles of Real-time OS Time Page Page 3.2 Service Call 3.2.1 Service Call Processing 3.2.2 Task Designation in Service call 3.3 Task 3.3.1 Task Status Page Page 3.3.2 Task Priority and Ready Queue TCB TCBTCB TCBTCB 3.3.3 Task Priority and Waiting Queue taskB taskC Page TCB the timeout function is used. 3.4 System States 3.4.1 Task Context and Non-task Context 1. Interrupt Handler 2. Cyclic Handler 3. Alarm Handler 3.4.2 Dispatch Enabled/Disabled States 3.4.3 CPU Locked/Unlocked States 3.4.4 Dispatch Disabled and CPU Locked States 3.5 MR308 Kernel Structure 3.5.1 Module Structure 3.5.2 Module Overview Scheduler 3.5.3 Task Management Function Activate Task (act_tsk, iact_tsk) Ter mi na te d Activate Task (sta_tsk, ista_tsk) Terminate Invoking Task (ext_tsk) Terminate Task (ter_tsk) Reference task priority (get_pri, iget_pri) Reference task status (simple version) (ref_tst, iref_tst) Reference task status (ref_tsk, iref_tsk) 3.5.4 Synchronization functions attached to task Put Task to sleep (slp_tsk,tslp_tsk) Wakeup task (wup_tsk, iwup_tsk) Wake up r eque st c oun t 0 0 1 0 0 Wakeup request count 0 0 1 2 1 Forcibly resume suspended task (frsm_tsk, ifrsm_tsk) Release task from waiting (rel_wai, irel_wai) Delay task (dly_tsk) 3.5.5 Synchronization and Communication Function (Semaphore) Semaphore Task A Release Semaphore Resource(sig_sem, isig_sem) Acquire Semaphore Resource(wai_sem, twai_sem) Acquire Semaphore Resource(pol_sem, ipol_sem) Reference Semaphore Status (ref_sem, iref_sem) 3.5.6 Synchronization and Communication Function (Eventflag) Set Eventflag (set_flg, iset_flg) Clear Eventflag (clr_flg, iclr_flg) Wait for Eventflag (wai_flg, twai_flg) Wait for Eventflag (polling)(pol_flg, ipol_flg) Reference Eventflag Status (ref_flg, iref_flg) Chapter 3 Introduction to MR308 - 40 - TaskF TaskD TaskB Send to Data Queue(snd_dtq, tsnd_dtq) Send to Data Queue (psnd_dtq, ipsnd_dtq) Forced Send to Data Queue (fsnd_dtq, ifsnd_dtq) Receive from Data Queue (rcv_dtq, trcv_dtq) Receive from Data Queue (prcv_dtq,iprcv_dtq) 3.5.8 Synchronization and Communication Function (Mailbox) Message Message TaskB TaskA Message queue Message A Message B Message C Send to Mailbox (snd_mbx, isnd_mbx) Receive from Mailbox (rcv_mbx, trcv_mbx) Receive from Mailbox (polling) (prcv_mbx, iprcv_mbx) Reference Mailbox Status (ref_mbx, iref_mbx) 3.5.9 Memory pool Management Function Acquire Fixed-size Memory Block (polling) (pget_mpf, ipget_mpf) Release Fixed-size Memory Block (rel_mpf, irel_mpf) Reference Fixed-size Memory Pool Status (ref_mpf, iref_mpf) Acquire Variable-size Memory Block (pget_mpl) Release Acquire Variable-size Memory Block (rel_mpl) Reference Acquire Variable-size Memory Pool Status (ref_mpl, iref_mpl) 3.5.10 Time Management Function Place a task in a finite time wait state by specifying a timeout value Page 3.5.11 Cyclic Handler Function Start Cyclic Handler Operation (sta_cyc, ista_cyc) Stop Cyclic Handler Operation (stp_cyc, istp_cyc) Reference Cyclic Handler Status (ref_cyc, iref_cyc) 3.5.12 Alarm Handler Function Start Alarm Handler Operation (sta_alm, ista_alm) Stop alarm Handler Operation (stp_alm, istp_alm) Reference Alarm Handler Status (ref_alm, iref_alm) Page 3.5.14 Interrupt Management Function Returns from interrupt handler (ret_int) 3.5.15 System Configuration Management Function References Version Information(ref_ver, iref_ver) 3.5.16 Extended Function (Short Data Queue) Send to Short Data Queue (vsnd_dtq, vtsnd_dtq) Send to Short Data Queue (vpsnd_dtq, vipsnd_dtq) Forced Send to Short Data Queue (vfsnd_dtq, vifsnd_dtq) Page 3.5.18 Service calls That Can Be Issued from Task and Handler Page Page Page Chapter 4 Applications Development Procedure Overview 4.1 Overview 1. Generating a project 2. Coding the application program 3. Creating a configuration file 4. Executing the configurator HEW Figure 4.1 MR308 System Generation Detail Flowchart Page Chapter 4 Applications Development Procedure Overview Figure 4.2 Program Example - 63 - Chapter 4 Applications Development Procedure Overview - 64 - 4.2.2 Configuration File Preparation Figure 4.3 Configuration File Example 4.2.3 Configurator Execution 4.2.4 System generation 4.2.5 Writing ROM Page Chapter 5 Detailed Applications Chapter 5 Detailed Applications - 68 - 5.1 Program Coding Procedure in C Language 5.1.1 Task Description Procedure 1. Describe the task as a function. Page 5.1.2 Writing a Kernel (OS Dependent) Interrupt Handler 5.1.3 Writing Non-kernel (OS-independent ) Interrupt Handler 5.1.4 Writing Cyclic Handler/Alarm Handler 5.2 Program Coding Procedure in Assembly Language 5.2.1 Writing Task Page 5.2.2 Writing Kernel(OS-dependent) Interrupt Handler 5.2.3 Writing Non-kernel(OS-independent) Interrupt Handler 5.2.4 Writing Cyclic Handler/Alarm Handler 5.3 The Use of INT Instruction 5.4 The Use of registers of bank 5.5 Regarding Interrupts 5.5.1 Types of Interrupt Handlers High Kernel(OS-dependent) interrupt handler Non-kernel(OS-independent) interrupt handler For service calls that can be issued from only task context. Page Page Page Page Chapter 5 Detailed Applications - 85 - 5.8.1 C Language Startup Program (crt0mr.a30) Chapter 5 Detailed Applications - 86 - Chapter 5 Detailed Applications - 87 - Chapter 5 Detailed Applications - 88 - Figure 5.14 C Language Startup Program (crt0mr.a30) Page 5.9 Memory Allocation asm_sec.inc c_sec.inc Page Page Page 5.10 Using in M16C/70 Series Page 6.1 Configuration File Creation Procedure 6.1.1 Configuration File Data Entry Format Comment Statement End of statement Numerical Value 123 123 + 0x23 (23/4 + 3) 100B + 0aH Symbol _TASK1 IDLE3 Function Name main() func() Page 6.1.2 Configuration File Definition Items Maximum value of priority ; Timeout function Task Pause Time tick denominator Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Chapter 6 Using Configurator - 119 - 6.1.3 Configuration File Example The following is the configuration file example. Chapter 6 Using Configurator - 120 - Chapter 6 Using Configurator - 121 - Page 6.2 Configurator Execution Procedures 6.2.1 Configurator Overview 1. Executing the configurator requires the following input files: Configuration file (XXXX.cfg) Default configuration file (default.cfg) cfg308 Page 6.2.3 Configurator Start Procedure Command Options -v Option -V Option -m Option 6.2.4 makefile generate Function 1. Examine the source file's dependency relationship. 2. Write the file dependency relationship to makefile Page 6.2.6 Configurator Error Indications and Remedies Error messages Page Warning messages Other messages 6.3 Editing makefile 6.4 About an error when you execute make mr308tbl Warning : You need not specify systime.timeout YES in configuration file tslp_tsk, twai_flg, trcv_mbx, twai_sem, tsnd_dtq, trcv_dtq, vtsnd_dtq, vtrcv_dtq Page Page 7.1 Processing Procedures for System Calls from Handlers 7.1.1 System Calls from a Handler That Caused an Interrupt during Task Execution 7.1.2 System Calls from a Handler That Caused an Interrupt during System Call Processing 7.1.3 System Calls from a Handler That Caused an Interrupt during Handler Execution 7.2 Stacks 7.2.1 System Stack and User Stack User Stack System Stack Page 8.1 Overview of Sample Program task2 operates in order of the following. Chapter 8 Sample Program Description - 143 - 8.2 Program Source Listing Chapter 8 Sample Program Description - 144 - 8.3 Configuration Fil e Page 9.1 How to Form Separate ROMs Programs to be located in the kernel ROM Programs to be located in the application ROM How to locate individual programs is given below. Page Page Page 2005. Renesas Technology Corp. and Renesas Solutions Corp.,