In the ti dsp Based on oseck RTOS, interruption can be used as a process. In the oseck system, there are two types of processes: priority process and interruption process. When the interruption is blocked (int4 ~ 15) after the occurrence, the corresponding interrupt vector will be executed. In the code of the vector, the process registered on the interrupt number will be found, and then the oseck will be responsible for scheduling, then switch to the blocked process. Similar to the priority process, this interrupt process also has a PCB (Process Control Block), and the shielded interrupt number (int4 ~) is stored in the odo_vect2pcb array ~ 15) ing with the PCB of the interrupt process (this is the meaning of vect2pcb). The index of the odo_vect2pcb array is used as the interrupt number, and the value of the array corresponding to the index stores the PCB pointer.
For example, you can output eventcombiner from intc module of ti dsp corepac to event0 ~ 3. The interrupted service program is created as an interrupted process. For example, you can bind event0 to an int5 interrupt, so that after the int5 interrupt occurs, _ vector5 will be executed, then, find the PCB pointer of the interrupted process corresponding to event0 through the assembly code _ odo_vect2pcb + vec_number * 4 below, and oseck switches to the process for execution, here, a variable in the PCB structure indicates the process entry point. The entry point is the event0 interrupted service program. After each interruption, after switching to the interrupted process, it starts from the entry point.
Odo_vect2pcb [0 ~ 15] = {limit 0, pcb1,..., limit 15 };
. Sect ". vectors"; reset the interrupted vector. _ Vector0:. nocmp bnop checkfunc, 5. Align 32; vector1 is used for NMI/Exception Processing. _ Vector1 :. nocmp; write the B15 value of the stack pointer to the gplyb register. Note that the gplyb register value is sacrificed here to save the B15 value. What is stored in B15 is the stack pointer of the process before redirecting to vector1, so save it. MVC B15, gplyb; assign the stack pointer of the prepared exception to B15 (Stack pointer. When a process is running, B15 points to the stack of the process). In this way, when exception is handled, the specified allocated stack exceptionerrorstackptr is used. Mvkl exceptionerrorstackptr, B15 mvkh exceptionerrorstackptr, B15 LDW * B15 [0], B15; jump to function execution with check errors. The bnop checkerrorfunc 5 command is equivalent to B checkerrorfunc and NOP 5. Bnop checkerrorfunc, 5; default vector2 ~ 15 implementation, with the ". macro" macro. Vector_macro. macro vec_num. align 32 _ vector: vec_num: stwb11, * B15 --; save B11 values in the stack (B15), | mvklhandlerfunc, B11; | indicates that this command is executed in parallel with the previous command and takes only one cycle time. Mvkhhandlerfunc, B11; jump to the handlerfunc function, because the B command has five cycle delays, and this bnop command contains one NOP, therefore, you can add four commands to execute in the remaining four cycle statements. The following four commands will switch to the handlerfunc function after these commands are executed. Bnop B11, 1 STW A11, * B15 -- STW A10, * B15 -- mvkl _ odo_vect2pcb + vec_number * 4, A11; in this way, the PCB of the interrupted process (Process Control Block) is saved in A11) pointer mvkh_odo_vect2pcb + vec_number * 4, A11. optional bytes 4vector_macro 5vector_macro 6vector_macro 7vector_macro 8vector_macro 9vector_macro 10vector_macro 11vector_macro 12vector_macro 13vector_macro 14vector_macro