#include <intrins.h>
void _trap_ (
unsigned int trapno); /* trap number to insert */
Description
The _trap_ routine allows you to invoke a trap (interrupt)
function or generate a software reset. This routine inserts a
TRAP or an SRST instruction into the program. If
trapno is zero, a SRST (software reset)
instruction is generated. If trapno is non-zero, a
TRAP instruction is generated. This routine is implemented as
an intrinsic function. The code is generated inline rather than being
called.
Return Value
None.
Example
1 #include <intrins.h>
2 #include <reg166.h>
3
4 void main (void) {
5 _trap_ (0x10); /* generates TRAP */
6 _trap_ (0x01); /* generates TRAP */
7 _trap_ (0x00); /* generates SRST */
8 }
ASSEMBLY LISTING OF GENERATED OBJECT CODE
; FUNCTION main (BEGIN RMASK = @0x8000)
; SOURCE LINE # 4
; SOURCE LINE # 5
0000 9B20 TRAP #010H
; SOURCE LINE # 6
0002 9B02 TRAP #01H
; SOURCE LINE # 7
0004 B748B7B7 SRST
; SOURCE LINE # 8
0008 CB00 RET
; FUNCTION main (END RMASK = @0x8000)
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.