TI-based DSP chip application program is divided into two kinds: general application; Dsp/bios application.
To simplify programming, TI provides a programming interface for C, which encapsulates all of TI's hardware modules in the form of APIs and macros, collectively known as Dsp/bios. The Dsp/bios contains the following modules:
System (contains Mem,sys objects)
Instrumentation (contains Log,sts objects)
scheduling (including objects such as CLK,PRD,HWI,SWI, etc.)
Synchronization (including objects such as Sem,mbx,que, etc.)
Input/output (including objects such as Rtdx,hst and so on), Chip support Library (including objects such as Dma,gpio, etc.).
Dsp/bios Program Boot sequence:
1) Initialize the DSP. The Dsp/bios program starts at the entrance c_int00. After reset, the reset interrupt vector automatically directs the program pointer to the c_init00. The system stack pointer SP is set to point to the end of the. Stack segment, and the status register St0 and ST1 are also initialized.
2) Initialize the. BSS segment from the record of the. Cinit segment, after the stack pointer is established, the initialization program initializes the global variable with the record of the. Cinit segment.
3) Call Bios_init to initialize each module of the Dsp/bios. Bios_init performs basic module initialization, and then calls the Mod_init macro to initialize each module used separately. For example, Hwi_init Initializes a register of hardware interrupts, establishes ISTP and interrupt selection registers, clears the IFR interrupt flag register, sets the IER interrupt enable register, HST_INIT initializes the host interface I/O Channel interface, and if RTDX is used, hst_ Init initializes the instruction count of the idle loop by 1;idl_init the corresponding position of the RTDX hardware interrupt in the IER, primarily to calibrate the CPU load graph to show the CPU burden.
4) processing. Pinit table: The Pinit table contains pointers to initialization functions, and for C + + programs, the constructors for global C + + objects are executed in the processing of pinit.
5) Call the user main program main function. After all the Dsp/bios modules are initialized, hardware interrupts and software interrupts are enabled, and the application can add code to initialize various peripherals. During initialization, it is necessary to maintain a ban on various interrupts.
6) Call Bios_start to start Dsp/bios. Like other functions, the Bios_start function is generated by the configuration tool, which is included in the Programcfg.snn file. The Bios_start is responsible for enabling the Dsp/bios module and invoking the Mod_startup macro for each module used to get it to work. For example, Clk_startup sets the PRD register to enable the IR register to correspond to the position of the selected clock in the CLK Manager 1, then start the clock, Swi_startup set the software interrupt, tsk_startup enable all the task threads. Hwi_startup sets the Gie bit in the CSR register to enable hardware interrupts; Pip_startup calls the Notifywriter function for each PIP object. If the Tsk Manager is enabled in the Configuration tool, then Bios_startup does not return.
7) Perform an idle loop. Call the Idl_loop bootstrapper to enter the Dsp/bios idle loop, at which time the hardware and software interrupts can abort the execution of the idle loop. The idle loop controls the channel of the DSP and the host, and the data communication between the host and the DSP system can be done during the idle loop.
In the Dsp/bios application, the main () function is used to implement user initialization, on-chip/off-chip peripheral configuration, and to enable separate hardware interrupts, etc., however, the main () function is not part of any thread type of Dsp/bios, it is just a passer-by, After the initialization of the user's expectations, the end is dead.
It is important to note that when the application executes the main function, not all Dsp/bios API functions can be called, and there is a corresponding relationship, because, when the main function is started, Dsp/bios does not complete the final initialization, therefore, The main function is restricted for calls to Dsp/bios some API functions.
From the DSP start-up process, Dsp/bios initialization is divided into two stages, one is located in front of the main function of the Bios_init, one is the main function behind the Bios_start.
Bios_init is primarily done with the initialization of the Mem module, while Bios_start is responsible for enabling global interrupts, configuring and starting timers, opening thread scheduling, starting Dsp/bios threads, and so on. Thus, in the main function, functions that implement dynamic memory allocations can be called: Mem_alloc, Mem_free, and API functions that dynamically create objects: Xxx_create, Xxx_delete, and so on. For "Assume that hardware interrupts and timers are enabled API", or may cause blocking API functions can not be called in the main function, such as Clk_gethtim, Clk_getltime, hwi_enable, hwi_disable, Swi_ Enable, swi_diaable, Tsk_disable, tsk_enable, Sem_pend, mbx_pend, etc. It is important to note that there must be no infinite loops in the main function, otherwise the entire Dsp/bios program will be paralyzed.
However, for the dispatch function that makes the Dsp/bios thread ready is allowed to be called in the main function, such as sem_post, Swi_post, etc., the essence of this is to wait for the Bios_start to perform all the initialization before executing the dispatch operation as above.
As a result, it can be understood that the main function is interspersed during the initialization of the BIOS, providing an opportunity for manual intervention of the Dsp/bios, making the BIOS more "personalized". During which the CPU control is submitted from Dsp/bios to the user, and then back to Dsp/bios.
Dsp/bios Program Boot Sequence