acsim_toolbox_c
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
acsim_toolbox_c [2006/08/09 11:21] – added toolbox header audiocommander | acsim_toolbox_c [2007/11/17 16:48] (current) – move acsim.zip to "acsim" namespace smashtv | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | This page is part of the [[mios_c_simulator_-_debugger]] | ||
+ | [[acsim_console_h|ACSim_console.h]]\\ | ||
+ | [[acsim_console_c|ACSim_console.c]]\\ | ||
+ | |||
+ | [[acsim_mios_h|ACSim_mios.h]]\\ | ||
+ | [[acsim_mios_c|ACSim_mios.c]]\\ | ||
+ | |||
+ | [[acsim_toolbox_h|ACSim_toolbox.h]]\\ | ||
+ | **[[acsim_toolbox_c|ACSim_toolbox.c]]**\\ | ||
+ | [[acmididefines|ACMidiDefines.h]]\\ | ||
+ | \\ | ||
+ | This code is for viewing only and may not be up to date. You can download the files in a zip file {{acsim: | ||
+ | \\ | ||
+ | \\ | ||
+ | <code c> | ||
+ | /* | ||
+ | | ||
+ | | ||
+ | * | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | * | ||
+ | */ | ||
+ | |||
+ | /* | ||
+ | * Released under GNU General Public License | ||
+ | * http:// | ||
+ | | ||
+ | * This program is free software; you can redistribute it and/or modify it under the terms | ||
+ | * of the GNU General Public License as published by the Free Software Foundation | ||
+ | * | ||
+ | * YOU ARE ALLOWED TO COPY AND CHANGE | ||
+ | * BUT YOU MUST RELEASE THE SOURCE TOO (UNDER GNU GPL) IF YOU RELEASE YOUR PRODUCT | ||
+ | * YOU ARE NOT ALLOWED NOT USE IT WITHIN PROPRIETARY CLOSED-SOURCE PROJECTS | ||
+ | */ | ||
+ | |||
+ | |||
+ | |||
+ | #import " | ||
+ | |||
+ | #import " | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | // generate some random numbers | ||
+ | unsigned char ACRandomBool(void) { return (random() % 2); } | ||
+ | signed char | ||
+ | unsigned char ACRandomPin(void) { return (random() % DEBUG_AIN_NUM); | ||
+ | unsigned char ACRandomChar(void) { return (random() % 128); } | ||
+ | unsigned int ACRandomInt(void) { return (random() % 1024); } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | // hexview output | ||
+ | // maybe configure defines in header! | ||
+ | |||
+ | void hexview(unsigned char *buf, int size) { | ||
+ | /* usage: | ||
+ | char buf[256]; | ||
+ | strcpy(buf, | ||
+ | hexview(buf, | ||
+ | |||
+ | int i; | ||
+ | unsigned char c; | ||
+ | unsigned char r = 0; | ||
+ | |||
+ | while (size>0) { | ||
+ | printf(" | ||
+ | for (i=0; | ||
+ | if (size-i> | ||
+ | printf(" | ||
+ | } else { | ||
+ | printf(" | ||
+ | } | ||
+ | } | ||
+ | printf(" | ||
+ | for (i=0; | ||
+ | c = (unsigned char)*(buf+i); | ||
+ | printf(" | ||
+ | } | ||
+ | buf+=HEXVIEW_CHARS; | ||
+ | size-=HEXVIEW_CHARS; | ||
+ | printf(" | ||
+ | r++; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | </ |