本文整理汇总了C++中System_abort函数的典型用法代码示例。如果您正苦于以下问题:C++ System_abort函数的具体用法?C++ System_abort怎么用?C++ System_abort使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了System_abort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serverTask
/*
* ======== serverTask ========
*/
Void serverTask(UArg arg0, UArg arg1)
{
MessageQ_Handle serverMessageQ;
MessageQ_QueueId replyQueue;
MessageQ_Msg msg;
UInt16 msgId;
Int status;
serverMessageQ = MessageQ_create(SERVERNAME, NULL);
/* Loop forever processing requests */
System_printf("Server is ready to set processing requests\n");
while (TRUE) {
/* Wait for a request. */
status = MessageQ_get(serverMessageQ, &msg, MessageQ_FOREVER);
if (status < 0) {
System_abort("Stopping test\n");
}
/* Get the id and increment it to send back as validation */
msgId = MessageQ_getMsgId(msg);
msgId += NUMCLIENTS;
MessageQ_setMsgId(msg, msgId);
/* Use the embedded reply destination */
replyQueue = MessageQ_getReplyQueue(msg);
/* Send the response back */
status = MessageQ_put(replyQueue, msg);
if (status < 0) {
System_abort("MessageQ_put was not successful\n");
}
}
}
示例2: tsk0_func
/*
* ======== tsk0_func ========
* Wait to be released then send an interrupt to the ARM processor
*/
Void tsk0_func(UArg arg0, UArg arg1)
{
Int status;
while (seq < NUMLOOPS) {
/* Wait to be released by callback function */
Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
System_printf("Received request #%d from ARM (lineId = 0)\n",
seq);
status = Notify_sendEvent(armProcId, LINE_1, EVENTID, seq, TRUE);
if (status < 0) {
System_abort("sendEvent failed\n");
}
System_printf("Sent request #%d to ARM (lineId = 1)\n", seq);
/* Wait to be released by the cbFxn posting the semaphore */
Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
System_printf("Received request #%d from ARM (lineId = 1)\n");
/* Send an event to the ARM */
status = Notify_sendEvent(armProcId, LINE_0, EVENTID, seq, TRUE);
if (status < 0) {
System_abort("sendEvent failed\n");
}
System_printf("Sent request #%d to ARM (lineId = 0)\n", seq);
}
System_printf("Test completed\n");
BIOS_exit(0);
}
示例3: loopbackFxn
/*
* ======== loopbackFxn========
* Receive and return messages.
* Run at priority lower than tsk1Fxn above.
* Inputs:
* - arg0: number of the thread, appended to MessageQ host and slave names.
*/
Void loopbackFxn(UArg arg0, UArg arg1)
{
MessageQ_Msg getMsg;
MessageQ_Handle messageQ;
MessageQ_QueueId remoteQueueId;
Int status;
UInt16 msgId = 0;
Char localQueueName[64];
Char hostQueueName[64];
System_printf("Thread loopbackFxn: %d\n", arg0);
System_sprintf(localQueueName, "%s_%d", SLAVE_MESSAGEQNAME, arg0);
System_sprintf(hostQueueName, "%s_%d", HOST_MESSAGEQNAME, arg0);
/* Create a message queue. */
messageQ = MessageQ_create(localQueueName, NULL);
if (messageQ == NULL) {
System_abort("MessageQ_create failed\n");
}
System_printf("loopbackFxn: created MessageQ: %s; QueueID: 0x%x\n",
localQueueName, MessageQ_getQueueId(messageQ));
System_printf("Start the main loop: %d\n", arg0);
while (msgId < NUMLOOPS) {
/* Get a message */
status = MessageQ_get(messageQ, &getMsg, MessageQ_FOREVER);
if (status != MessageQ_S_SUCCESS) {
System_abort("This should not happen since timeout is forever\n");
}
remoteQueueId = MessageQ_getReplyQueue(getMsg);
#ifndef BENCHMARK
System_printf("%d: Received message #%d from core %d\n",
arg0, MessageQ_getMsgId(getMsg),
MessageQ_getProcId(remoteQueueId));
#endif
/* test id of message received */
if (MessageQ_getMsgId(getMsg) != msgId) {
System_abort("The id received is incorrect!\n");
}
#ifndef BENCHMARK
/* Send it back */
System_printf("%d: Sending message Id #%d to core %d\n",
arg0, msgId, MessageQ_getProcId(remoteQueueId));
#endif
status = MessageQ_put(remoteQueueId, getMsg);
if (status != MessageQ_S_SUCCESS) {
System_abort("MessageQ_put had a failure/error\n");
}
msgId++;
}
MessageQ_delete(&messageQ);
numTests += NUMLOOPS;
System_printf("Test thread %d complete!\n", arg0);
}
示例4: USBCDCD_init
/*
* ======== USBCDCD_init ========
*/
void USBCDCD_init(void)
{
Hwi_Handle hwi;
Error_Block eb;
Error_init(&eb);
/* Install interrupt handler */
hwi = Hwi_create(INT_USB0, USBCDCD_LoggerIdle_hwiHandler, NULL, &eb);
if (hwi == NULL) {
System_abort("Can't create USB Hwi");
}
/* State specific variables */
state = USBCDCD_STATE_UNCONFIGURED;
/* Set the USB stack mode to Device mode with VBUS monitoring */
USBStackModeSet(0, eUSBModeForceDevice, 0);
/* Initialize the transmit buffer */
USBBufferInit(&txBuffer);
/*
* Pass our device information to the USB HID device class driver,
* initialize the USB controller and connect the device to the bus.
*/
if (!USBDCDCInit(0, &serialDevice)) {
System_abort("Error initializing the serial device");
}
}
示例5: main
/*
* ======== main ========
* Synchronizes all processors.
* Creates a HeapBufMP and registers it with MessageQ.
*/
Int main(Int argc, Char* argv[])
{
Int status;
HeapBufMP_Handle heapHandle;
HeapBufMP_Params heapBufParams;
/*
* Ipc_start() calls Ipc_attach() to synchronize all remote processors
* because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
*/
status = Ipc_start();
if (status < 0) {
System_abort("Ipc_start failed\n");
}
/*
* Create the heap that will be used to allocate messages.
*/
HeapBufMP_Params_init(&heapBufParams);
heapBufParams.regionId = 0;
heapBufParams.name = HEAP_NAME;
heapBufParams.align = HEAP_ALIGN;
heapBufParams.numBlocks = HEAP_NUMMSGS;
heapBufParams.blockSize = HEAP_MSGSIZE;
heapHandle = HeapBufMP_create(&heapBufParams);
if (heapHandle == NULL) {
System_abort("HeapBufMP_create failed\n" );
}
/* Register this heap with MessageQ */
MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);
BIOS_start();
return (0);
}
示例6: main
int main(void)
{
/* Call board init functions */
uint32_t ui32SysClock;
ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120E6);
Board_initGeneral(ui32SysClock);
Board_initEMAC();
Board_initGPIO();
// Board_initI2C();
// Board_initSDSPI();
// Board_initSPI();
// Board_initUART();
// Board_initUSB(Board_USBDEVICE);
// Board_initUSBMSCHFatFs();
// Board_initWatchdog();
// Board_initWiFi();
setup_ledcube();
Mailbox_Params mbox_Params;
Error_Block eb;
Error_init(&eb);
_sem = Semaphore_create(0, NULL, &eb);
if (_sem == NULL) {
System_abort("Couldn't create semaphore");
}
ledEvent = Event_create(NULL,&eb);
Mailbox_Params_init(&mbox_Params);
mbox_Params.readerEvent=ledEvent;
mbox_Params.readerEventId=Event_Id_01;
mbox_led = Mailbox_create(sizeof(struct ledMatrix),1, &mbox_Params, &eb);
if(mbox_led == NULL){
// Do something with errorblock, in the real world
System_abort("woho!");
}
create_led_task((UArg) mbox_led);
//netOpenHook((UArg) mbox_led);
netOpenHook(mbox_led);
System_printf("Starting the example\nSystem provider is set to SysMin. "
"Halt the target to view any SysMin contents in ROV.\n");
/* SysMin will only print to the console when you call flush or exit */
System_flush();
/* Start BIOS */
BIOS_start();
return (0);
}
示例7: smain
/* ARGSUSED */
Void smain(UArg arg0, UArg arg1)
{
SemThread_Params semParams;
Task_Params taskParams;
Task_Handle tsk;
Int i;
Log_print0(Diags_ENTRY, "[+E] smain> Enter ");
SemThread_Params_init(&semParams);
done = SemThread_create(0, &semParams, NULL);
SemThread_Params_init(&semParams);
mutex = SemThread_create(1, &semParams, NULL);
if ((done == NULL) || (mutex == NULL)) {
Log_print0(Diags_USER7, "[+7] smain> SemThread creation failed");
System_abort("SemThread_create failed \n");
}
Task_Params_init(&taskParams);
/*
* Add the following line to have the stack allocated from the external
* heap:
* taskParams.stackHeap = (IHeap_Handle)EXTMEM_HEAP;
*/
taskParams.stackSize = 0x1000;
for (i = 0; i < NUMTASKS; i++) {
Task_Params_init(&taskParams);
taskParams.priority = attrsTable[i].priority;
taskParams.arg0 = i + 1; /* task id */
taskParams.arg1 = i; /* index into attrsTable */
tsk = Task_create((Task_FuncPtr)rmanTask, &taskParams, NULL);
if (tsk == NULL) {
Log_print1(Diags_USER7, "[+7] smain> Task_create of task %d failed",
(IArg)(i + 1));
System_abort("Task_create() failed\n");
}
}
for (i = 0; i < NUMTASKS; i++) {
SemThread_pend(done, SemThread_FOREVER, NULL);
}
SemThread_delete(&mutex);
SemThread_delete(&done);
Log_print0(Diags_USER4, "[+4] smain> TEST PASSED ");
Log_print0(Diags_EXIT, "[+X] smain> Exit ");
}
示例8: cycleLED
Void cycleLED(UArg arg0, UArg arg1)
{
unsigned int i = 0;
uint8_t writeBuffer[4];
I2C_Handle handle;
I2C_Params i2cparams;
I2C_Transaction i2c;
I2C_Params_init(&i2cparams);
i2cparams.bitRate = I2C_400kHz;
handle = I2C_open(Board_I2C_TPL0401, &i2cparams);
if (handle == NULL) {
System_abort("I2C was not opened");
}
i2c.slaveAddress = Board_TPL0401_ADDR;
i2c.readCount = 0;
i2c.readBuf = NULL;
i2c.writeBuf = writeBuffer;
/* Enable the PWM oscillator */
writeBuffer[0] = 0x00;
writeBuffer[1] = 0x81;
i2c.writeCount = 2;
if (!I2C_transfer(handle, &i2c)) {
GPIO_write(Board_LED1, Board_LED_ON);
System_abort("Bad I2C transfer!");
}
/* Bring the LEDs into PWM mode */
writeBuffer[0] = 0x8C;
writeBuffer[1] = 0xAA;
writeBuffer[2] = 0xAA;
i2c.writeCount = 3;
if (!I2C_transfer(handle, &i2c)) {
GPIO_write(Board_LED1, Board_LED_ON);
System_abort("Bad I2C transfer!");
}
i2c.writeCount = 4;
while (true) {
/* Point to the new LED pattern */
i2c.writeBuf = (uint8_t *) &(rgbcmd[i]);
if (!I2C_transfer(handle, &i2c)) {
GPIO_write(Board_LED1, Board_LED_ON);
System_abort("Bad I2C transfer!");
}
/* Reached the end of the RGB patterns; reset index */
if (rgbcmd[++i].LED == 0x00) {
i = 0;
}
Task_sleep(100);
}
}
示例9: tsk0
/*
* ======== tsk0 ========
*/
Void tsk0(UArg arg0, UArg arg1)
{
Int status;
MessageQ_Msg msg;
System_printf("tsk0 starting\n");
/* Register this heap with MessageQ */
MessageQ_registerHeap((IHeap_Handle)SharedRegion_getHeap(0), HEAP_ID);
/* Open the 'next' remote message queue. Spin until it is ready. */
do {
status = MessageQ_open(nextQueueName, &nextQueueId);
}
while (status < 0);
if (selfId == 0) {
msg = MessageQ_alloc(HEAP_ID, MSGSIZE);
if (msg == NULL) {
System_abort("MessageQ_alloc failed\n");
}
/* Kick off the loop */
status = MessageQ_put(nextQueueId, msg);
if (status < 0) {
System_abort("MessageQ_put failed\n");
}
}
for (numReceived = 0; numReceived < NUMLOOPS; numReceived++) {
/* Get a message */
status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
if (status < 0) {
System_abort("MessageQ_get failed\n");
}
if (selfId == 0) {
rawtimestamps[numReceived] = Timestamp_get32();
if (numReceived == NUMLOOPS - 1) {
printStatistics();
break;
}
}
status = MessageQ_put(nextQueueId, msg);
if (status < 0) {
System_abort("MessageQ_put failed\n");
}
}
System_exit(0);
}
示例10: main
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
IRES_Status status;
/* Set default Diags mask to all, to get trace for init() functions */
FCSettings_init();
Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");
buf = Memory_calloc(NULL, BUFSIZE, BUFALIGN, NULL);
if (buf == NULL) {
System_abort("Allocation of buffer for BUFRES failed. Aborting.\n");
}
status = RMAN_init();
//Diags_setMask(RMAN_MODNAME"+EX1234567");
if (IRES_OK != status) {
System_printf("main> RMAN initialization Failed [%d]\n", status);
System_abort("Aborting...\n");
}
config.iresConfig.size = sizeof(BUFRES_Params);
// config.iresConfig.allocFxn = _ALG_allocMemory;
// config.iresConfig.freeFxn = _ALG_freeMemory;
config.iresConfig.allocFxn = DSKT2_allocPersistent;
config.iresConfig.freeFxn = DSKT2_freePersistent;
config.base = buf;
config.length = (UInt32)BUFSIZE;
status = RMAN_register(&BUFRES_MGRFXNS, (IRESMAN_Params *)&config);
/*
* Now that are resource is initialized,
* set default Diags mask to warnings and errors
*/
Diags_setMask(FCSETTINGS_MODNAME"-EX12345");
//Diags_setMask(BUFRES_MODNAME"-EX12345");
if (status != IRES_OK) {
/* Test failed */
System_printf("BUFRES_init() failed [0x%x]\n", status);
System_abort("Aborting.\n");
return (-1);
}
smain(argc, argv);
return (0);
}
示例11: main
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
IRES_Status status;
Int size = 0;
// TODO: Use Diags_setMask()
#if 0
GT_init();
GT_create(&CURTRACE, "ti.sdo.fc.rman.examples.hdvicp");
GT_set(MOD_NAME "=01234567");
GT_set("ti.sdo.fc.rman" "=4567");
GT_set("ti.sdo.fc.dskt2" "=67");
GT_set("ti.sdo.fc.ires.hdvicp" "=01234567");
/* GT_set("ti.sdo.fc.dskt2" "=01234567");*/
#endif
Log_print0(Diags_ENTRY, "[+E] _main> Enter ");
status = RMAN_init();
if (IRES_OK != status) {
Log_print1(Diags_USER7, "[+7] main> RMAN_init() failed [%d]",
(IArg)status);
System_abort("RMAN_init() failed, aborting...\n");
}
/*
* Supply initialization information for the RESMAN while registering
*/
size = sizeof(IRESMAN_HdVicpParams);
configParams.baseConfig.allocFxn = RMAN_PARAMS.allocFxn;
configParams.baseConfig.freeFxn = RMAN_PARAMS.freeFxn;
configParams.baseConfig.size = size;
/* Register the HDVICP protocol/resource manager with the
* generic resource manager */
status = RMAN_register(&IRESMAN_HDVICP, (IRESMAN_Params *)&configParams);
if (IRES_OK != status) {
Log_print1(Diags_USER7, "[+7] main> RMAN_register() failed [%d]",
(IArg)status);
System_abort("RMAN_register() failed, aborting...\n");
}
Log_print0(Diags_EXIT, "[+X] main> Exit");
BIOS_start();
return(0);
}
示例12: main
Int main(Int argc, Char* argv[])
{
Error_Block eb;
Task_Params taskParams;
Registry_Result result;
Log_print0(Diags_ENTRY, "--> main:");
/* must initialize the error block before using it */
Error_init(&eb);
/* create main thread (interrupts not enabled in main on BIOS) */
Task_Params_init(&taskParams);
taskParams.instance->name = "smain";
taskParams.stackSize = 0x1000;
Task_create(smain, &taskParams, &eb);
if (Error_check(&eb)) {
System_abort("main: failed to create application startup thread");
}
/* register with xdc.runtime to get a diags mask */
result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
/* start scheduler, this never returns */
BIOS_start();
/* should never get here */
Log_print0(Diags_EXIT, "<-- main:");
return (0);
}
示例13: main
/*
* ======== main ========
*/
Int main(Int argc, Char* argv[])
{
selfId = MultiProc_self();
System_printf("Core (\"%s\") starting\n", MultiProc_getName(selfId));
if (numCores == 0) {
numCores = MultiProc_getNumProcessors();
}
attachAll(numCores);
System_sprintf(localQueueName, "CORE%d", selfId);
System_sprintf(nextQueueName, "CORE%d",
((selfId + 1) % numCores));
System_sprintf(prevQueueName, "CORE%d",
(selfId - 1 + numCores)
% numCores);
/* Create a message queue. */
messageQ = MessageQ_create(localQueueName, NULL);
if (messageQ == NULL) {
System_abort("MessageQ_create failed\n" );
}
BIOS_start();
return (0);
}
示例14: DSKT2_initLocks
/*
* ======== DSKT2_initLocks ========
* Implements yield function and initializes all the
* the lock semaphores, and yield contexts.
*/
Void DSKT2_initLocks()
{
Int i;
/*
* Initialize the yielding context and lock create flags
*/
for (i = 0; i < DSKT2_NUM_SCRATCH_GROUPS; i++) {
_DSKT2_yieldingContext[i] = NULL;
/*
* Note, an optimization could be to allow this array to be
* sparse, and only create enough semaphores for the groups that
* will be used. Might require some extra config on the user's part
* but it would save on some resources in environments where sems
* are heavy.
*/
_locks[i] = Semaphore_create(1, NULL, NULL);
if (_locks[i] == NULL) {
/* This is a fatal error */
System_abort("DSKT2_initLocks(): Semaphore creation failed\n");
}
}
}
示例15: printDrive
/*
* ======== printDrive ========
* Function to print drive information such as the total disk space
* This function was created by referencing FatFs's API documentation
* http://elm-chan.org/fsw/ff/en/getfree.html
*
* This function call may take a while to process, depending on the size of
* SD Card used.
*/
void printDrive(const char *driveNumber, FATFS **fatfs)
{
FRESULT fresult;
DWORD freeClusterCount;
DWORD totalSectorCount;
DWORD freeSectorCount;
System_printf("Reading disk information...");
System_flush();
fresult = f_getfree(driveNumber, &freeClusterCount, fatfs);
if (fresult) {
System_abort("Error getting the free cluster count from the FatFs object");
}
else {
System_printf("done\n");
/* Get total sectors and free sectors */
totalSectorCount = ((*fatfs)->n_fatent - 2) * (*fatfs)->csize;
freeSectorCount = freeClusterCount * (*fatfs)->csize;
/* Print the free space (assuming 512 bytes/sector) */
System_printf("Total Disk size: %10lu KiB\n"
"Free Disk space: %10lu KiB\n",
totalSectorCount / 2,
freeSectorCount / 2);
}
}