├── .gitignore ├── MLO_XMODEM ├── Tools ├── tiimage ├── tiimage.exe ├── TemplateManager.jar ├── ScheduleGenerator.jar ├── TemplateGenerator.jar └── README.txt ├── Hardware ├── ehrpwm.c ├── debug.c ├── README.txt ├── timertick_bb.c ├── include │ ├── perf.h │ ├── hw_pwmss.h │ ├── systick.h │ ├── delay.h │ ├── pwmss.h │ ├── ascii.h │ ├── cpu.h │ ├── consoleUtils.h │ ├── debug.h │ ├── mdio.h │ ├── misc.h │ ├── cache.h │ ├── error.h │ ├── uartStdio.h │ ├── hw_usbphyGS70.h │ ├── hw_types.h │ ├── board.h │ ├── cp15.h │ ├── mailbox.h │ ├── hw_cm_device.h │ ├── hw_cm_mpu.h │ ├── hw_tps65217.h │ ├── hw_cm_rtc.h │ ├── hw_cm_cefuse.h │ └── cmdline.h ├── device.c ├── perf.c ├── board_bb.c ├── board.c ├── pruss.c ├── usbphyGS70.c ├── sysperf_bb.c ├── delay.c ├── systick.c └── usb_bb.c ├── PATHS.bat ├── Application ├── module.png ├── system.h ├── partition1_partition.h ├── partition2_partition.h ├── partition3_partition.h ├── configuration.h ├── module_module.h ├── system.c ├── partition2_partition.c ├── partition3_partition.c └── module_module.c ├── PATHS.sh ├── ARINC653_PORT ├── include │ ├── cpu.h │ ├── timer_tick.h │ ├── timer_delay.h │ ├── protocol.h │ ├── console.h │ ├── ethernet.h │ └── arinc653_port_types.h ├── timer_delay.c └── timer_tick.c ├── MAKE_DEBUG.sh ├── CLEAN_DEBUG.sh ├── CLEAN_RELEASE.sh ├── MAKE_RELEASE.sh ├── CLEAN_DEBUG.bat ├── CLEAN_RELEASE.bat ├── MAKE_DEBUG.bat ├── MAKE_RELEASE.bat ├── ARINC653 ├── include │ ├── arinc653_partitionManagement.h │ ├── arinc653_common.h │ ├── arinc653_scheduler.h │ ├── arinc653_processManagement.h │ ├── arinc653_configuration.h │ ├── arinc653_heap.h │ ├── arinc653_interpartitionCommunication_queuingPort.h │ ├── arinc653_interpartitionCommunication_samplingPort.h │ ├── arinc653_clock.h │ ├── arinc653_healthMonitoring.h │ └── arinc653_priorityqueue.h ├── arinc653_systemManagement.c ├── arinc653_common.c ├── arinc653_heap.c ├── arinc653_configuration.c └── arinc653_priorityqueue.c ├── REGENERATE.sh ├── REGENERATE.bat ├── Library ├── README.txt └── usblib │ ├── readme.txt │ ├── usbdata.c │ └── include │ ├── usb-ids.h │ ├── usbhhidmouse.h │ ├── usbhhidkeyboard.h │ └── usbdevicepriv.h ├── Instruments ├── include │ ├── track.h │ ├── measure.h │ └── test.h ├── track.c ├── test.c └── measure.c ├── .ccsproject ├── .project ├── LICENSE ├── AM335x_PRU_ICSS.gel ├── README.md └── AM3359.ccxml /.gitignore: -------------------------------------------------------------------------------- 1 | /.launches 2 | /.settings 3 | /Debug 4 | /Release -------------------------------------------------------------------------------- /MLO_XMODEM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/MLO_XMODEM -------------------------------------------------------------------------------- /Tools/tiimage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/Tools/tiimage -------------------------------------------------------------------------------- /Hardware/ehrpwm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/Hardware/ehrpwm.c -------------------------------------------------------------------------------- /PATHS.bat: -------------------------------------------------------------------------------- 1 | set PATH_CCS=C:\ti\ccs1040\ccs 2 | set PATH_PROJECT=D:\CCSWorkspace\ARINC653_ARMV7A_AM335X -------------------------------------------------------------------------------- /Tools/tiimage.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/Tools/tiimage.exe -------------------------------------------------------------------------------- /Application/module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/Application/module.png -------------------------------------------------------------------------------- /PATHS.sh: -------------------------------------------------------------------------------- 1 | export PATH_CCS=/home/ti/ccs930/ccs 2 | export PATH_PROJECT=/home/lfarcaro/CCSWorkspace/ARINC653_ARMV7A_AM335X -------------------------------------------------------------------------------- /Tools/TemplateManager.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/Tools/TemplateManager.jar -------------------------------------------------------------------------------- /Tools/ScheduleGenerator.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/Tools/ScheduleGenerator.jar -------------------------------------------------------------------------------- /Tools/TemplateGenerator.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfarcaro/ARINC653_ARMV7A_AM335X/HEAD/Tools/TemplateGenerator.jar -------------------------------------------------------------------------------- /ARINC653_PORT/include/cpu.h: -------------------------------------------------------------------------------- 1 | #ifndef CPU_H 2 | #define CPU_H 3 | 4 | #define CPU_CORECOUNT 1 5 | 6 | #endif /* CPU_H */ 7 | -------------------------------------------------------------------------------- /MAKE_DEBUG.sh: -------------------------------------------------------------------------------- 1 | source PATHS.sh 2 | mkdir $PATH_PROJECT/Debug 3 | cd $PATH_PROJECT/Debug 4 | $PATH_CCS/utils/bin/gmake -k -j 8 all -------------------------------------------------------------------------------- /CLEAN_DEBUG.sh: -------------------------------------------------------------------------------- 1 | source PATHS.sh 2 | mkdir $PATH_PROJECT/Debug 3 | cd $PATH_PROJECT/Debug 4 | $PATH_CCS/utils/bin/gmake -k clean 5 | -------------------------------------------------------------------------------- /CLEAN_RELEASE.sh: -------------------------------------------------------------------------------- 1 | source PATHS.sh 2 | mkdir $PATH_PROJECT/Release 3 | cd $PATH_PROJECT/Release 4 | $PATH_CCS/utils/bin/gmake -k clean -------------------------------------------------------------------------------- /MAKE_RELEASE.sh: -------------------------------------------------------------------------------- 1 | source PATHS.sh 2 | mkdir $PATH_PROJECT/Release 3 | cd $PATH_PROJECT/Release 4 | $PATH_CCS/utils/bin/gmake -k -j 8 all -------------------------------------------------------------------------------- /CLEAN_DEBUG.bat: -------------------------------------------------------------------------------- 1 | call PATHS.bat 2 | mkdir %PATH_PROJECT%\Debug 3 | cd %PATH_PROJECT%\Debug 4 | %PATH_CCS%\utils\bin\gmake.exe -k clean 5 | -------------------------------------------------------------------------------- /CLEAN_RELEASE.bat: -------------------------------------------------------------------------------- 1 | call PATHS.bat 2 | mkdir %PATH_PROJECT%\Release 3 | cd %PATH_PROJECT%\Release 4 | %PATH_CCS%\utils\bin\gmake.exe -k clean -------------------------------------------------------------------------------- /MAKE_DEBUG.bat: -------------------------------------------------------------------------------- 1 | call PATHS.bat 2 | mkdir %PATH_PROJECT%\Debug 3 | cd %PATH_PROJECT%\Debug 4 | %PATH_CCS%\utils\bin\gmake.exe -k -j 8 all -------------------------------------------------------------------------------- /MAKE_RELEASE.bat: -------------------------------------------------------------------------------- 1 | call PATHS.bat 2 | mkdir %PATH_PROJECT%\Release 3 | cd %PATH_PROJECT%\Release 4 | %PATH_CCS%\utils\bin\gmake.exe -k -j 8 all -------------------------------------------------------------------------------- /Tools/README.txt: -------------------------------------------------------------------------------- 1 | The tiimage tool was obtained from TI's AM335X StarterWare (https://sourceforge.net/p/starterwarefree/code/ci/master/tree/). -------------------------------------------------------------------------------- /Application/system.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSTEM_H_ 2 | #define SYSTEM_H_ 3 | 4 | // ARINC653 includes 5 | #include "arinc653.h" 6 | 7 | // System default module 8 | extern void SYSTEM_DEFAULTMODULE(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Application/partition1_partition.h: -------------------------------------------------------------------------------- 1 | #ifndef PARTITION1_PARTITION_H_ 2 | #define PARTITION1_PARTITION_H_ 3 | 4 | // ARINC653 includes 5 | #include "arinc653.h" 6 | 7 | // PARTITION1 partition default process 8 | extern void PARTITION1_DEFAULTPROCESS(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Application/partition2_partition.h: -------------------------------------------------------------------------------- 1 | #ifndef PARTITION2_PARTITION_H_ 2 | #define PARTITION2_PARTITION_H_ 3 | 4 | // ARINC653 includes 5 | #include "arinc653.h" 6 | 7 | // PARTITION2 partition default process 8 | extern void PARTITION2_DEFAULTPROCESS(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Application/partition3_partition.h: -------------------------------------------------------------------------------- 1 | #ifndef PARTITION3_PARTITION_H_ 2 | #define PARTITION3_PARTITION_H_ 3 | 4 | // ARINC653 includes 5 | #include "arinc653.h" 6 | 7 | // PARTITION3 partition default process 8 | extern void PARTITION3_DEFAULTPROCESS(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Application/configuration.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGURATION_H_ 2 | #define CONFIGURATION_H_ 3 | 4 | // System configuration 5 | extern SYSTEM_CONFIGURATION_TYPE SYSTEM_CONFIGURATION; 6 | 7 | // MODULE module configuration 8 | extern MODULE_CONFIGURATION_TYPE MODULE_MODULE_CONFIGURATION; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_partitionManagement.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_PARTITIONMANAGEMENT_H_ 2 | #define ARINC653_PARTITIONMANAGEMENT_H_ 3 | 4 | // Partition internal identifier getter 5 | void GET_PARTITION_INTERNAL_IDENTIFIER(PARTITION_ID_TYPE PARTITION_EXTERNAL_IDENTIFIER, PARTITION_ID_TYPE *PARTITION_INTERNAL_IDENTIFIER, RETURN_CODE_TYPE *RETURN_CODE); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /REGENERATE.sh: -------------------------------------------------------------------------------- 1 | java -jar Tools/TemplateManager.jar C COLLAPSE Application Application.art "^.+\.[ch]$" "" YES 2 | java -jar Tools/TemplateGenerator.jar ARMV7A_AM335X Application Application/module.xml 3 | java -jar Tools/TemplateManager.jar C EXPAND Application Application.art "^.+\.[ch]$" "" YES 4 | java -jar Tools/ScheduleGenerator.jar Application/module.xml PNG Application/module.png -------------------------------------------------------------------------------- /REGENERATE.bat: -------------------------------------------------------------------------------- 1 | java -jar Tools\TemplateManager.jar C COLLAPSE Application Application.art "^.+\.[ch]$" "" YES 2 | java -jar Tools\TemplateGenerator.jar ARMV7A_AM335X Application Application\module.xml 3 | java -jar Tools\TemplateManager.jar C EXPAND Application Application.art "^.+\.[ch]$" "" YES 4 | java -jar Tools\ScheduleGenerator.jar Application\module.xml PNG Application\module.png 5 | pause -------------------------------------------------------------------------------- /Library/README.txt: -------------------------------------------------------------------------------- 1 | This folder's files were obtained from TI's AM335X StarterWare (https://sourceforge.net/p/starterwarefree/code/ci/master/tree/). 2 | 3 | Changes and new implementations were performed as follows. 4 | 5 | - Interrupts enabling suppressed in "usbdenum.c", for operation in polling mode. 6 | - Fixed conditional code in "usbhostenum.c". 7 | - Added joystick-related constants in "usbhid.h". -------------------------------------------------------------------------------- /ARINC653_PORT/include/timer_tick.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMER_TICK_H_ 2 | #define TIMER_TICK_H_ 3 | 4 | // Includes 5 | #include "arinc653_port_types.h" 6 | #include "beaglebone.h" 7 | #include "dmtimer.h" 8 | #include "interrupt.h" 9 | 10 | // Startup method 11 | unsigned char TIMER_TICK_STARTUP(void (*HANDLER)(void)); 12 | 13 | // Shutdown method 14 | unsigned char TIMER_TICK_SHUTDOWN(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /Application/module_module.h: -------------------------------------------------------------------------------- 1 | #ifndef MODULE_MODULE_H_ 2 | #define MODULE_MODULE_H_ 3 | 4 | // ARINC653 includes 5 | #include "arinc653.h" 6 | 7 | // Partitions includes 8 | #include "partition1_partition.h" 9 | #include "partition2_partition.h" 10 | #include "partition3_partition.h" 11 | 12 | // MODULE module default partition 13 | extern void MODULE_MODULE_DEFAULTPARTITION(void); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Hardware/debug.c: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // Function that is called when an invalid argument is passed to an API. 4 | // This is only used when doing a DEBUG build. 5 | // 6 | //***************************************************************************** 7 | void __error__(char *pcFilename, unsigned int ulLine) { 8 | while(1) {} 9 | } 10 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_common.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_COMMON_H_ 2 | #define ARINC653_COMMON_H_ 3 | 4 | // Null-terminated string copy method 5 | BOOLEAN_TYPE COMMON_COPYSTRING(CHARACTER_TYPE *FROM, CHARACTER_TYPE *TO, SIZE_TYPE MAXIMUM_LENGTH); 6 | 7 | // Null-terminated string comparison method 8 | BOOLEAN_TYPE COMMON_COMPARESTRINGS(CHARACTER_TYPE *STRING1, CHARACTER_TYPE *STRING2, SIZE_TYPE MAXIMUM_LENGTH); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_scheduler.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_SCHEDULER_H_ 2 | #define ARINC653_SCHEDULER_H_ 3 | 4 | // Start partition scheduler method 5 | void SCHEDULER_STARTPARTITIONSCHEDULER(RETURN_CODE_TYPE *RETURN_CODE); 6 | 7 | // Start process scheduler method 8 | void SCHEDULER_STARTPROCESSSCHEDULER(RETURN_CODE_TYPE *RETURN_CODE); 9 | 10 | // Scheduler 11 | void SCHEDULER(void); 12 | 13 | // Tick method 14 | void TICK(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /ARINC653_PORT/include/timer_delay.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMER_DELAY_H_ 2 | #define TIMER_DELAY_H_ 3 | 4 | // Includes 5 | #include "arinc653_port_types.h" 6 | #include "beaglebone.h" 7 | #include "dmtimer.h" 8 | 9 | // Counter value for 1ms 10 | #define TIMER_DELAY_COUNT_1MS 24000u 11 | 12 | // Startup method 13 | unsigned char TIMER_DELAY_STARTUP(void); 14 | 15 | // Delay method for milliseconds 16 | void TIMER_DELAY_MS(unsigned int MS); 17 | 18 | // Shutdown method 19 | unsigned char TIMER_DELAY_SHUTDOWN(void); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_processManagement.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_PROCESSMANAGEMENT_H_ 2 | #define ARINC653_PROCESSMANAGEMENT_H_ 3 | 4 | // Wait resource method 5 | void WAIT_RESOURCE(PARTITION_ID_TYPE PARTITION_ID, PROCESS_ID_TYPE PROCESS_ID, priorityqueueRECORD *REC_RESOURCE, SYSTEM_TIME_TYPE TIME_OUT, RETURN_CODE_TYPE *RETURN_CODE); 6 | 7 | // Signal resource method 8 | void SIGNAL_RESOURCE(PARTITION_ID_TYPE PARTITION_ID, priorityqueueRECORD *REC_RESOURCE, BOOLEAN_TYPE RESCHEDULE, RETURN_CODE_TYPE *RETURN_CODE); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_configuration.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_CONFIGURATION_H_ 2 | #define ARINC653_CONFIGURATION_H_ 3 | 4 | // System configuration 5 | extern SYSTEM_CONFIGURATION_TYPE SYSTEM_CONFIGURATION; 6 | 7 | // Get partition configuration method 8 | PARTITION_CONFIGURATION_TYPE *CONFIGURATION_GETPARTITIONCONFIGURATION(PARTITION_NAME_TYPE PARTITION_NAME); 9 | 10 | // Get process configuration method 11 | PROCESS_CONFIGURATION_TYPE *CONFIGURATION_GETPROCESSCONFIGURATION(PARTITION_CONFIGURATION_TYPE *PARTITION_CONFIGURATION, PROCESS_NAME_TYPE PROCESS_NAME); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /Instruments/include/track.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACK_H_ 2 | #define TRACK_H_ 3 | 4 | // ARINC653 core includes 5 | #include "arinc653_core.h" 6 | 7 | // Track timer clock frequency 8 | #define TRACK_TIMER_CLOCKFREQUENCY 24000000 9 | 10 | // Track timer clock prescaler 11 | #define TRACK_TIMER_CLOCKPRESCALER DMTIMER_PRESCALER_CLK_DIV_BY_256 12 | 13 | // Track timer effective clock frequency 14 | #define TRACK_TIMER_EFFECTIVECLOCKFREQUENCY 93750 15 | 16 | // Track startup method 17 | void TRACK_STARTUP(void); 18 | 19 | // Track reading method 20 | unsigned int TRACK_READ(void); 21 | 22 | // Track termination method 23 | void TRACK_TERMINATE(void); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /.ccsproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_heap.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_HEAP_H_ 2 | #define ARINC653_HEAP_H_ 3 | 4 | // Pointer 5 | typedef portBYTE *heapPOINTER; 6 | 7 | // Size 8 | typedef portSIZE heapSIZE; 9 | 10 | // Record 11 | struct _heapRECORD { 12 | heapPOINTER PTR_POINTER; 13 | heapSIZE SIZ_SIZE; 14 | heapSIZE SIZ_ALIGNMENT; 15 | heapSIZE SIZ_FULL; 16 | }; 17 | typedef struct _heapRECORD heapRECORD; 18 | 19 | // Heap startup method 20 | void HEAP_STARTUP(heapRECORD *REC_HEAP, heapPOINTER PTR_POINTER, heapSIZE SIZ_SIZE, heapSIZE SIZ_ALIGNMENT); 21 | 22 | // Heap allocate method - If pointer is not null and force flag is false, keeps it unchanged 23 | void HEAP_ALLOCATE(heapRECORD *REC_HEAP, heapPOINTER *PTR_POINTER, heapSIZE SIZ_LENGTH, BOOLEAN_TYPE FORCE); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /ARINC653/arinc653_systemManagement.c: -------------------------------------------------------------------------------- 1 | // ARINC653 includes 2 | #include "arinc653_core.h" 3 | 4 | // System startup method 5 | void STARTUP_SYSTEM(RETURN_CODE_TYPE *RETURN_CODE) { 6 | 7 | // Sets system configuration 8 | SYSTEM_INFORMATION.SYSTEM_CONFIGURATION = &SYSTEM_CONFIGURATION; 9 | 10 | // Calls hook 11 | if (!PORT_HOOK_STARTUP_SYSTEM()) { 12 | 13 | // Sets return code 14 | *RETURN_CODE = INVALID_CONFIG; 15 | return; 16 | } 17 | 18 | // Sets return code 19 | *RETURN_CODE = NO_ERROR; 20 | } 21 | 22 | // System running method 23 | void RUN_SYSTEM(RETURN_CODE_TYPE *RETURN_CODE) { 24 | 25 | // Calls hook 26 | if (!PORT_HOOK_RUN_SYSTEM()) { 27 | 28 | // Sets return code 29 | *RETURN_CODE = INVALID_CONFIG; 30 | return; 31 | } 32 | 33 | // Sets return code 34 | *RETURN_CODE = NO_ERROR; 35 | } 36 | -------------------------------------------------------------------------------- /Instruments/track.c: -------------------------------------------------------------------------------- 1 | // General includes 2 | #include "track.h" 3 | 4 | // Track startup method 5 | void TRACK_STARTUP(void) { 6 | 7 | // Enables clocks for DMTimer 8 | DMTimer3ModuleClkConfig(); 9 | 10 | // Configures clock prescaler for DMTimer 11 | DMTimerPreScalerClkEnable(SOC_DMTIMER_3_REGS, TRACK_TIMER_CLOCKPRESCALER); 12 | 13 | // Configures DMTimer 14 | DMTimerModeConfigure(SOC_DMTIMER_3_REGS, DMTIMER_ONESHOT_NOCMP_ENABLE); 15 | 16 | // Loads initial value 17 | DMTimerCounterSet(SOC_DMTIMER_3_REGS, 0); 18 | 19 | // Enables DMTimer 20 | DMTimerEnable(SOC_DMTIMER_3_REGS); 21 | } 22 | 23 | // Track reading method 24 | unsigned int TRACK_READ(void) { 25 | return DMTimerCounterGet(SOC_DMTIMER_3_REGS); 26 | } 27 | 28 | // Track termination method 29 | void TRACK_TERMINATE(void) { 30 | 31 | // Disables DMTimer 32 | DMTimerDisable(SOC_DMTIMER_3_REGS); 33 | } 34 | -------------------------------------------------------------------------------- /Instruments/include/measure.h: -------------------------------------------------------------------------------- 1 | #ifndef MEASURE_H_ 2 | #define MEASURE_H_ 3 | 4 | // ARINC653 core includes 5 | #include "arinc653_core.h" 6 | 7 | // Global variables 8 | extern portBOOLEAN MEASURE_RUNNING; // Indicates a measurement was triggered and is running 9 | extern portUINT32 MEASURE_VALUE; // Stores the value of the finished measurement 10 | extern portUINTBASE MEASURE_CONTEXTID; // Stores the identifier of the context to be measured 11 | 12 | // Measure startup method 13 | void MEASURE_STARTUP(void); 14 | 15 | // Measure starting method 16 | portBOOLEAN MEASURE_START(portUINTBASE CONTEXTID); 17 | 18 | // Measure pausing method 19 | void MEASURE_PAUSE(void); 20 | 21 | // Measure resuming method 22 | void MEASURE_RESUME(void); 23 | 24 | // Measure stopping method 25 | void MEASURE_STOP(void); 26 | 27 | // Measure reading method 28 | portUINT32 MEASURE_READ(void); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ARINC653_ARMV7A_AM335X 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 15 | full,incremental, 16 | 17 | 18 | 19 | 20 | 21 | com.ti.ccstudio.core.ccsNature 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.core.ccnature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_interpartitionCommunication_queuingPort.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_INTERPARTITIONCOMMUNICATION_QUEUINGPORT_H_ 2 | #define ARINC653_INTERPARTITIONCOMMUNICATION_QUEUINGPORT_H_ 3 | 4 | // Partition queuing port identifier getter 5 | void GET_PARTITION_QUEUING_PORT_ID(PARTITION_ID_TYPE PARTITION_ID, QUEUING_PORT_NAME_TYPE QUEUING_PORT_NAME, QUEUING_PORT_ID_TYPE *QUEUING_PORT_ID, RETURN_CODE_TYPE *RETURN_CODE); 6 | 7 | // Send queuing message method 8 | void SEND_PARTITION_QUEUING_MESSAGE(PARTITION_ID_TYPE PARTITION_ID, QUEUING_PORT_ID_TYPE QUEUING_PORT_ID, MESSAGE_ADDR_TYPE MESSAGE_ADDR, MESSAGE_SIZE_TYPE LENGTH, RETURN_CODE_TYPE *RETURN_CODE); 9 | 10 | // Receive partition queuing message method 11 | void RECEIVE_PARTITION_QUEUING_MESSAGE(PARTITION_ID_TYPE PARTITION_ID, QUEUING_PORT_ID_TYPE QUEUING_PORT_ID, MESSAGE_ADDR_TYPE MESSAGE_ADDR, MESSAGE_SIZE_TYPE *LENGTH, BOOLEAN_TYPE PEEK, RETURN_CODE_TYPE *RETURN_CODE); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_interpartitionCommunication_samplingPort.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_INTERPARTITIONCOMMUNICATION_SAMPLINGPORT_H_ 2 | #define ARINC653_INTERPARTITIONCOMMUNICATION_SAMPLINGPORT_H_ 3 | 4 | // Partition sampling port identifier getter 5 | void GET_PARTITION_SAMPLING_PORT_ID(PARTITION_ID_TYPE PARTITION_ID, SAMPLING_PORT_NAME_TYPE SAMPLING_PORT_NAME, SAMPLING_PORT_ID_TYPE *SAMPLING_PORT_ID, RETURN_CODE_TYPE *RETURN_CODE); 6 | 7 | // Write partition sampling message method 8 | void WRITE_PARTITION_SAMPLING_MESSAGE(PARTITION_ID_TYPE PARTITION_ID, SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID, MESSAGE_ADDR_TYPE MESSAGE_ADDR, MESSAGE_SIZE_TYPE LENGTH, RETURN_CODE_TYPE *RETURN_CODE); 9 | 10 | // Read partition sampling message method 11 | void READ_PARTITION_SAMPLING_MESSAGE(PARTITION_ID_TYPE PARTITION_ID, SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID, MESSAGE_ADDR_TYPE MESSAGE_ADDR, MESSAGE_SIZE_TYPE *LENGTH, BOOLEAN_TYPE PEEK, RETURN_CODE_TYPE *RETURN_CODE); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /ARINC653_PORT/include/protocol.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOCOL_H_ 2 | #define PROTOCOL_H_ 3 | 4 | // Includes 5 | #include "hw_types.h" 6 | 7 | // General definitions 8 | #ifndef null 9 | #define null 0 10 | #endif 11 | 12 | // Definitions 13 | 14 | // Ethernet/IP/UDP packet interpretation method 15 | unsigned char INTERPRET_ETHERNET_IP_UDP_PACKET(unsigned char *PACKET, unsigned int PACKET_LENGTH, unsigned char *SOURCE_MAC_ADDRESS, unsigned char *DESTINATION_MAC_ADDRESS, unsigned int *SOURCE_ADDRESS, unsigned int *DESTINATION_ADDRESS, unsigned short *SOURCE_PORT, unsigned short *DESTINATION_PORT, unsigned int *DATA_INDEX, unsigned int *DATA_LENGTH); 16 | 17 | // Ethernet/IP/UDP packet preparation method 18 | unsigned int PREPARE_ETHERNET_IP_UDP_PACKET(unsigned char *BUFFER, unsigned int BUFFER_LENGTH, unsigned char *SOURCE_MAC_ADDRESS, unsigned char *DESTINATION_MAC_ADDRESS, unsigned int SOURCE_ADDRESS, unsigned int DESTINATION_ADDRESS, unsigned short SOURCE_PORT, unsigned short DESTINATION_PORT, unsigned char *DATA, unsigned int DATA_INDEX, unsigned int DATA_LENGTH); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /Library/usblib/readme.txt: -------------------------------------------------------------------------------- 1 | This project will build the Stellaris USB Library. 2 | 3 | ------------------------------------------------------------------------------- 4 | 5 | Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved. 6 | Software License Agreement 7 | 8 | Texas Instruments (TI) is supplying this software for use solely and 9 | exclusively on TI's microcontroller products. The software is owned by 10 | TI and/or its suppliers, and is protected under applicable copyright 11 | laws. You may not combine this software with "viral" open-source 12 | software in order to form a larger program. 13 | 14 | THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | DAMAGES, FOR ANY REASON WHATSOEVER. 20 | 21 | This is part of revision 6288 of the Stellaris USB Library. 22 | -------------------------------------------------------------------------------- /ARINC653_PORT/timer_delay.c: -------------------------------------------------------------------------------- 1 | // Includes 2 | #include "timer_delay.h" 3 | 4 | // Startup method 5 | unsigned char TIMER_DELAY_STARTUP(void) { 6 | 7 | // Enables clocks for DMTimer 8 | DMTimer7ModuleClkConfig(); 9 | 10 | // Configures DMTimer 11 | DMTimerModeConfigure(SOC_DMTIMER_7_REGS, DMTIMER_ONESHOT_NOCMP_ENABLE); 12 | 13 | // Enables DMTimer 14 | DMTimerEnable(SOC_DMTIMER_7_REGS); 15 | return 1; 16 | } 17 | 18 | // Delay method for milliseconds 19 | void TIMER_DELAY_MS(unsigned int MS) { 20 | 21 | // Iterates units 22 | while (MS != 0) { 23 | 24 | // Sets timer to zero 25 | DMTimerCounterSet(SOC_DMTIMER_7_REGS, 0); 26 | 27 | // Enables timer 28 | DMTimerEnable(SOC_DMTIMER_7_REGS); 29 | 30 | // Waits for timer to reach 1ms 31 | while (DMTimerCounterGet(SOC_DMTIMER_7_REGS) < TIMER_DELAY_COUNT_1MS); 32 | 33 | // Disables timer 34 | DMTimerDisable(SOC_DMTIMER_7_REGS); 35 | 36 | // Decrements unit 37 | MS--; 38 | } 39 | } 40 | 41 | // Shutdown method 42 | unsigned char TIMER_DELAY_SHUTDOWN(void) { 43 | 44 | // Disables DMTimer 45 | DMTimerDisable(SOC_DMTIMER_7_REGS); 46 | return 1; 47 | } 48 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_clock.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_CLOCK_H_ 2 | #define ARINC653_CLOCK_H_ 3 | 4 | // Startup macro 5 | #define CLOCK_STARTUP(); {\ 6 | /*Starts up*/\ 7 | MODULE_INFORMATION->MAJOR_FRAME_START = 0;\ 8 | MODULE_INFORMATION->MAJOR_FRAME_TIME = 0;\ 9 | MODULE_INFORMATION->NEXT_MAJOR_FRAME_START = MODULE_INFORMATION->MODULE_CONFIGURATION->MAJORFRAME_DURATION;\ 10 | } 11 | 12 | // Tick window macro 13 | #define CLOCK_TICKWINDOW(); {\ 14 | /*Counts time*/\ 15 | MODULE_INFORMATION->MAJOR_FRAME_TIME += PORT_TICKWINDOW;\ 16 | } 17 | 18 | // Tick major frame macro 19 | #define CLOCK_TICKMAJORFRAME(); {\ 20 | /*Counts major frame time*/\ 21 | MODULE_INFORMATION->MAJOR_FRAME_START += MODULE_INFORMATION->MODULE_CONFIGURATION->MAJORFRAME_DURATION;\ 22 | /*Resets major frame time*/\ 23 | MODULE_INFORMATION->MAJOR_FRAME_TIME = 0;\ 24 | /*Calculates next major frame start*/\ 25 | MODULE_INFORMATION->NEXT_MAJOR_FRAME_START = MODULE_INFORMATION->MAJOR_FRAME_START + MODULE_INFORMATION->MODULE_CONFIGURATION->MAJORFRAME_DURATION;\ 26 | } 27 | 28 | // System time getter macro 29 | #define CLOCK_GETSYSTEMTIME() (MODULE_INFORMATION->MAJOR_FRAME_START + MODULE_INFORMATION->MAJOR_FRAME_TIME) 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /ARINC653/arinc653_common.c: -------------------------------------------------------------------------------- 1 | // ARINC653 includes 2 | #include "arinc653_core.h" 3 | 4 | // Null-terminated string copy method 5 | BOOLEAN_TYPE COMMON_COPYSTRING(CHARACTER_TYPE *FROM, CHARACTER_TYPE *TO, SIZE_TYPE MAXIMUM_LENGTH) { 6 | INDEX_TYPE CHARACTER_INDEX; 7 | 8 | // Initializes character index 9 | CHARACTER_INDEX = 0; 10 | 11 | // Compare loop 12 | while (CHARACTER_INDEX < MAXIMUM_LENGTH) { 13 | 14 | // Copies character 15 | TO[CHARACTER_INDEX] = FROM[CHARACTER_INDEX]; 16 | 17 | // Verifies string end 18 | if (FROM[CHARACTER_INDEX++] == 0) { 19 | return true; 20 | } 21 | } 22 | 23 | // Maximum length reached 24 | return false; 25 | } 26 | 27 | // Null-terminated string comparison method 28 | BOOLEAN_TYPE COMMON_COMPARESTRINGS(CHARACTER_TYPE *STRING1, CHARACTER_TYPE *STRING2, SIZE_TYPE MAXIMUM_LENGTH) { 29 | INDEX_TYPE CHARACTER_INDEX; 30 | 31 | // Initializes character index 32 | CHARACTER_INDEX = 0; 33 | 34 | // Compare loop 35 | while (CHARACTER_INDEX < MAXIMUM_LENGTH) { 36 | 37 | // Compares characters 38 | if (STRING1[CHARACTER_INDEX] != STRING2[CHARACTER_INDEX]) { 39 | break; 40 | } 41 | 42 | // Verifies string end 43 | if (STRING1[CHARACTER_INDEX++] == 0) { 44 | return true; 45 | } 46 | } 47 | 48 | // Different strings 49 | return false; 50 | } 51 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_healthMonitoring.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_HEALTHMONITORING_H_ 2 | #define ARINC653_HEALTHMONITORING_H_ 3 | 4 | // Run system error action method 5 | void RUN_SYSTEM_ERROR_ACTION(BOOLEAN_TYPE ENTERCORE, BOOLEAN_TYPE YIELD, SYSTEM_STATE_TYPE SYSTEM_STATE, ERROR_IDENTIFIER_TYPE ERROR_IDENTIFIER); 6 | 7 | // Run module error action method 8 | void RUN_MODULE_ERROR_ACTION(BOOLEAN_TYPE ENTERCORE, BOOLEAN_TYPE YIELD, SYSTEM_STATE_TYPE SYSTEM_STATE, ERROR_IDENTIFIER_TYPE ERROR_IDENTIFIER); 9 | 10 | // Stop module health monitoring callback method 11 | void STOP_MODULE_HEALTHMONITORINGCALLBACK(void); 12 | 13 | // Run partition error action method 14 | void RUN_PARTITION_ERROR_ACTION(BOOLEAN_TYPE ENTERCORE, BOOLEAN_TYPE YIELD, SYSTEM_STATE_TYPE SYSTEM_STATE, ERROR_IDENTIFIER_TYPE ERROR_IDENTIFIER); 15 | 16 | // Stop partition health monitoring callback method 17 | void STOP_PARTITION_HEALTHMONITORINGCALLBACK(void); 18 | 19 | // Raise error method 20 | void RAISE_ERROR(BOOLEAN_TYPE ENTERCORE, BOOLEAN_TYPE YIELD, BOOLEAN_TYPE SYSTEM_PARTITION_CONTEXT, SYSTEM_STATE_TYPE SYSTEM_STATE, ERROR_IDENTIFIER_TYPE ERROR_IDENTIFIER, ERROR_CODE_TYPE ERROR_CODE, MESSAGE_ADDR_TYPE MESSAGE_ADDR, ERROR_MESSAGE_SIZE_TYPE LENGTH, PROCESS_ID_TYPE FAILED_PROCESS_ID, SYSTEM_ADDRESS_TYPE FAILED_ADDRESS, RETURN_CODE_TYPE *RETURN_CODE); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2019, Luís Fernando Arcaro 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /Instruments/include/test.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_H_ 2 | #define TEST_H_ 3 | 4 | // ARINC653 core includes 5 | #include "arinc653_core.h" 6 | 7 | // Test LED macros 8 | #define TEST_LED1_ON(); {\ 9 | HWREG(SOC_GPIO_1_REGS + GPIO_SETDATAOUT) = ((1 << 21) | (1 << 2));\ 10 | } 11 | #define TEST_LED2_ON(); {\ 12 | HWREG(SOC_GPIO_1_REGS + GPIO_SETDATAOUT) = ((1 << 24) | (1 << 6));\ 13 | } 14 | #define TEST_LED1_OFF(); {\ 15 | HWREG(SOC_GPIO_1_REGS + GPIO_CLEARDATAOUT) = ((1 << 21) | (1 << 2));\ 16 | } 17 | #define TEST_LED2_OFF(); {\ 18 | HWREG(SOC_GPIO_1_REGS + GPIO_CLEARDATAOUT) = ((1 << 24) | (1 << 6));\ 19 | } 20 | 21 | // Test counter values 22 | #define TEST_COUNTER_TINY 0x3000 // LED on/off loop should run in <~1ms 23 | #define TEST_COUNTER_TINYSMALL 0xB880 // LED on/off loop should run in <~5ms 24 | #define TEST_COUNTER_SMALL 0x1A100 // LED on/off loop should run in <~10ms 25 | #define TEST_COUNTER_SMALLMEDIUM 0x46B00 // LED on/off loop should run in <~25ms 26 | #define TEST_COUNTER_MEDIUM 0x90800 // LED on/off loop should run in <~50ms 27 | #define TEST_COUNTER_MEDIUMLARGE 0x124800 // LED on/off loop should run in <~100ms 28 | #define TEST_COUNTER_LARGE 0x2E0800 // LED on/off loop should run in <~250ms 29 | #define TEST_COUNTER_LARGEHUGE 0x8A7800 // LED on/off loop should run in <~750ms 30 | #define TEST_COUNTER_HUGE 0xB7D000 // LED on/off loop should run in <~1s 31 | 32 | // Test startup method 33 | unsigned char TEST_STARTUP(void); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Application/system.c: -------------------------------------------------------------------------------- 1 | // System include 2 | #include "system.h" 3 | 4 | // Configuration include 5 | #include "configuration.h" 6 | 7 | // SNIPPET_START GLOBAL_INCLUDES 8 | // Test include 9 | #include "test.h" 10 | // SNIPPET_END 11 | 12 | // -------------------- SYSTEM DESCRIPTION START -------------------- 13 | // SNIPPET_START SYSTEM_DESCRIPTION 14 | // SNIPPET_END 15 | // -------------------- SYSTEM DESCRIPTION END -------------------- 16 | 17 | // SNIPPET_START SYSTEM_INCLUDES 18 | // SNIPPET_END 19 | 20 | // SNIPPET_START SYSTEM_GLOBAL_DEFINITIONS 21 | // SNIPPET_END 22 | 23 | // SNIPPET_START SYSTEM_GLOBAL_VARIABLES 24 | // SNIPPET_END 25 | 26 | // SNIPPET_START SYSTEM_FUNCTIONS 27 | // SNIPPET_END 28 | 29 | // System default module 30 | void SYSTEM_DEFAULTMODULE(void) { 31 | RETURN_CODE_TYPE RETURN_CODE; 32 | // SNIPPET_START SYSTEM_DEFAULTMODULE_VARIABLES 33 | // SNIPPET_END 34 | 35 | // Starts system up 36 | STARTUP_SYSTEM(&RETURN_CODE); 37 | if (RETURN_CODE != NO_ERROR) { 38 | // SNIPPET_START STARTUP_SYSTEM_ERROR_HANDLING_CODE 39 | while (true) { 40 | } 41 | // SNIPPET_END 42 | } 43 | 44 | // SNIPPET_START SYSTEM_DEFAULTMODULE_INITIALIZATION 45 | // Starts up test 46 | TEST_STARTUP(); 47 | // SNIPPET_END 48 | 49 | // Runs system 50 | RUN_SYSTEM(&RETURN_CODE); 51 | if (RETURN_CODE != NO_ERROR) { 52 | // SNIPPET_START RUN_SYSTEM_ERROR_HANDLING_CODE 53 | while (true) { 54 | } 55 | // SNIPPET_END 56 | } 57 | 58 | // Exit loop (should never be reached) 59 | while (true); 60 | } 61 | -------------------------------------------------------------------------------- /ARINC653_PORT/timer_tick.c: -------------------------------------------------------------------------------- 1 | // Includes 2 | #include "timer_tick.h" 3 | 4 | // Startup method 5 | unsigned char TIMER_TICK_STARTUP(void (*HANDLER)(void)) { 6 | 7 | // First tick must occur after the first period, not immediately, 8 | // once the scheduler is already called at time zero 9 | 10 | // Enables clocks for DMTimer 11 | DMTimer2ModuleClkConfig(); 12 | 13 | // Registers system tick ISR 14 | IntRegister(SYS_INT_TINT2, HANDLER); 15 | 16 | // Sets interrupt priority 17 | IntPrioritySet(SYS_INT_TINT2, 0, AINTC_HOSTINT_ROUTE_IRQ); 18 | 19 | // Enables system interrupt 20 | IntSystemEnable(SYS_INT_TINT2); 21 | 22 | // Load initial count value 23 | DMTimerCounterSet(SOC_DMTIMER_2_REGS, 0xFFFFA23Fu); 24 | 25 | // Loads reload count value 26 | DMTimerReloadSet(SOC_DMTIMER_2_REGS, 0xFFFFA23Fu); 27 | 28 | // Configures DMTimer 29 | DMTimerModeConfigure(SOC_DMTIMER_2_REGS, DMTIMER_AUTORLD_NOCMP_ENABLE); 30 | 31 | // Enables DMTimer interrupts 32 | DMTimerIntEnable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG); 33 | 34 | // Enables DMTimer 35 | DMTimerEnable(SOC_DMTIMER_2_REGS); 36 | return 1; 37 | } 38 | 39 | // Shutdown method 40 | unsigned char TIMER_TICK_SHUTDOWN(void) { 41 | 42 | // Disables DMTimer 43 | DMTimerDisable(SOC_DMTIMER_2_REGS); 44 | 45 | // Disables DMTimer interrupts 46 | DMTimerIntDisable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG); 47 | 48 | // Disables system interrupt 49 | IntSystemDisable(SYS_INT_TINT2); 50 | 51 | // Unregisters system tick ISR 52 | IntUnRegister(SYS_INT_TINT2); 53 | return 1; 54 | } 55 | -------------------------------------------------------------------------------- /Application/partition2_partition.c: -------------------------------------------------------------------------------- 1 | // Partition include 2 | #include "partition2_partition.h" 3 | 4 | // SNIPPET_START GLOBAL_INCLUDES 5 | // Test include 6 | #include "test.h" 7 | // SNIPPET_END 8 | 9 | // -------------------- PARTITION DESCRIPTION START -------------------- 10 | // SNIPPET_START PARTITION2_PARTITION_DESCRIPTION 11 | // SNIPPET_END 12 | // -------------------- PARTITION DESCRIPTION END -------------------- 13 | 14 | // SNIPPET_START PARTITION2_PARTITION_INCLUDES 15 | // SNIPPET_END 16 | 17 | // SNIPPET_START PARTITION2_PARTITION_GLOBAL_DEFINITIONS 18 | // SNIPPET_END 19 | 20 | // SNIPPET_START PARTITION2_PARTITION_GLOBAL_VARIABLES 21 | // SNIPPET_END 22 | 23 | // SNIPPET_START PARTITION2_PARTITION_FUNCTIONS 24 | // SNIPPET_END 25 | 26 | // PARTITION2 partition default process 27 | void PARTITION2_DEFAULTPROCESS(void) { 28 | RETURN_CODE_TYPE RETURN_CODE; 29 | // SNIPPET_START PARTITION2_PARTITION_DEFAULTPROCESS_VARIABLES 30 | // SNIPPET_END 31 | 32 | // SNIPPET_START PARTITION2_PARTITION_DEFAULTPROCESS_INITIALIZATION 33 | // SNIPPET_END 34 | 35 | // Sets partition mode 36 | SET_PARTITION_MODE(NORMAL, &RETURN_CODE); 37 | if (RETURN_CODE != NO_ERROR) { 38 | // SNIPPET_START SET_PARTITION_MODE_ERROR_HANDLING_CODE 39 | while (true) { 40 | } 41 | // SNIPPET_END 42 | } 43 | 44 | // Start of idle process 45 | 46 | // SNIPPET_START PARTITION2_PARTITION_IDLEPROCESS_INITIALIZATION 47 | // SNIPPET_END 48 | 49 | // Main loop 50 | while (true) { 51 | 52 | // SNIPPET_START PARTITION2_PARTITION_IDLEPROCESS_CODE 53 | // Sets LEDs pattern 54 | TEST_LED1_OFF(); 55 | TEST_LED2_OFF(); 56 | // SNIPPET_END 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Application/partition3_partition.c: -------------------------------------------------------------------------------- 1 | // Partition include 2 | #include "partition3_partition.h" 3 | 4 | // SNIPPET_START GLOBAL_INCLUDES 5 | // Test include 6 | #include "test.h" 7 | // SNIPPET_END 8 | 9 | // -------------------- PARTITION DESCRIPTION START -------------------- 10 | // SNIPPET_START PARTITION3_PARTITION_DESCRIPTION 11 | // SNIPPET_END 12 | // -------------------- PARTITION DESCRIPTION END -------------------- 13 | 14 | // SNIPPET_START PARTITION3_PARTITION_INCLUDES 15 | // SNIPPET_END 16 | 17 | // SNIPPET_START PARTITION3_PARTITION_GLOBAL_DEFINITIONS 18 | // SNIPPET_END 19 | 20 | // SNIPPET_START PARTITION3_PARTITION_GLOBAL_VARIABLES 21 | // SNIPPET_END 22 | 23 | // SNIPPET_START PARTITION3_PARTITION_FUNCTIONS 24 | // SNIPPET_END 25 | 26 | // PARTITION3 partition default process 27 | void PARTITION3_DEFAULTPROCESS(void) { 28 | RETURN_CODE_TYPE RETURN_CODE; 29 | // SNIPPET_START PARTITION3_PARTITION_DEFAULTPROCESS_VARIABLES 30 | // SNIPPET_END 31 | 32 | // SNIPPET_START PARTITION3_PARTITION_DEFAULTPROCESS_INITIALIZATION 33 | // SNIPPET_END 34 | 35 | // Sets partition mode 36 | SET_PARTITION_MODE(NORMAL, &RETURN_CODE); 37 | if (RETURN_CODE != NO_ERROR) { 38 | // SNIPPET_START SET_PARTITION_MODE_ERROR_HANDLING_CODE 39 | while (true) { 40 | } 41 | // SNIPPET_END 42 | } 43 | 44 | // Start of idle process 45 | 46 | // SNIPPET_START PARTITION3_PARTITION_IDLEPROCESS_INITIALIZATION 47 | // SNIPPET_END 48 | 49 | // Main loop 50 | while (true) { 51 | 52 | // SNIPPET_START PARTITION3_PARTITION_IDLEPROCESS_CODE 53 | // Sets LEDs pattern 54 | TEST_LED1_OFF(); 55 | TEST_LED2_OFF(); 56 | // SNIPPET_END 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ARINC653_PORT/include/console.h: -------------------------------------------------------------------------------- 1 | #ifndef CONSOLE_H_ 2 | #define CONSOLE_H_ 3 | 4 | // Includes 5 | #include 6 | #include "arinc653_port_types.h" 7 | #include "beaglebone.h" 8 | #include "uart_irda_cir.h" 9 | #include "consoleUtils.h" 10 | #include "uartStdio.h" 11 | 12 | // Console UART base address 13 | #define CONSOLE_UARTBASEADDRESS SOC_UART_0_REGS 14 | 15 | // Console UART baud rate 16 | #define CONSOLE_UARTBAUDRATE 230400 17 | 18 | // Console UART input clock 19 | #define CONSOLE_UARTINPUTCLOCK 48000000 20 | 21 | // Startup method 22 | unsigned char CONSOLE_STARTUP(void); 23 | 24 | // Byte writing method 25 | unsigned char CONSOLE_WRITE_BYTE(unsigned char BYTE); 26 | 27 | // Byte writing with count-out method 28 | unsigned char CONSOLE_WRITE_BYTE_COUNTOUT(unsigned char BYTE, int COUNT); 29 | 30 | // Byte reading method 31 | unsigned char CONSOLE_READ_BYTE(unsigned char *BYTE); 32 | 33 | // Byte reading with count-out method 34 | unsigned char CONSOLE_READ_BYTE_COUNTOUT(unsigned char *BYTE, int COUNT); 35 | 36 | // Buffer writing method 37 | unsigned int CONSOLE_WRITE_BUFFER(unsigned char *BUFFER, unsigned int LENGTH); 38 | 39 | // Buffer reading method 40 | unsigned int CONSOLE_READ_BUFFER(unsigned char *BUFFER, unsigned int LENGTH); 41 | 42 | // String printing method 43 | void CONSOLE_PUTS(const char *STRING, unsigned int LENGTH); 44 | 45 | // Number printing method 46 | unsigned int CONSOLE_PRINTN(int VALUE, unsigned char BASE, unsigned char SIGNED, unsigned char UPPERCASE, unsigned char PADDING_CHARACTER, int PADDING_LENGTH); 47 | 48 | // Formatted printing method 49 | void CONSOLE_PRINTF(const char *STRING, ...); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /Instruments/test.c: -------------------------------------------------------------------------------- 1 | // General includes 2 | #include "test.h" 3 | 4 | // Hardware includes 5 | #include "hw_control_AM335x.h" 6 | #include "soc_AM335x.h" 7 | #include "hw_types.h" 8 | 9 | // Test startup method 10 | unsigned char TEST_STARTUP(void) { 11 | // Enables GPIO module clock 12 | GPIO1ModuleClkConfig(); 13 | 14 | // Selects pins for use 15 | HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(5)) = CONTROL_CONF_MUXMODE(7); 16 | HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(6)) = CONTROL_CONF_MUXMODE(7); 17 | HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(7)) = CONTROL_CONF_MUXMODE(7); 18 | HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(8)) = CONTROL_CONF_MUXMODE(7); 19 | HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_AD(2)) = CONTROL_CONF_MUXMODE(7); 20 | HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_AD(6)) = CONTROL_CONF_MUXMODE(7); 21 | HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_AD(13)) = CONTROL_CONF_MUXMODE(7); 22 | 23 | // Enables GPIO module 24 | GPIOModuleEnable(SOC_GPIO_1_REGS); 25 | 26 | // Resets GPIO module 27 | GPIOModuleReset(SOC_GPIO_1_REGS); 28 | 29 | // Sets pins mode 30 | GPIODirModeSet(SOC_GPIO_1_REGS, 21, GPIO_DIR_OUTPUT); 31 | GPIODirModeSet(SOC_GPIO_1_REGS, 22, GPIO_DIR_OUTPUT); 32 | GPIODirModeSet(SOC_GPIO_1_REGS, 23, GPIO_DIR_OUTPUT); 33 | GPIODirModeSet(SOC_GPIO_1_REGS, 24, GPIO_DIR_OUTPUT); 34 | GPIODirModeSet(SOC_GPIO_1_REGS, 2, GPIO_DIR_OUTPUT); 35 | GPIODirModeSet(SOC_GPIO_1_REGS, 6, GPIO_DIR_OUTPUT); 36 | GPIODirModeSet(SOC_GPIO_1_REGS, 13, GPIO_DIR_OUTPUT); 37 | 38 | // Accesses the GPIO controller's pins 39 | TEST_LED1_ON(); 40 | TEST_LED2_ON(); 41 | 42 | // Accesses the GPIO controller's pins 43 | TEST_LED1_OFF(); 44 | TEST_LED2_OFF(); 45 | return 1; 46 | } 47 | -------------------------------------------------------------------------------- /ARINC653/arinc653_heap.c: -------------------------------------------------------------------------------- 1 | // ARINC653 includes 2 | #include "arinc653_core.h" 3 | 4 | // Heap startup method 5 | void HEAP_STARTUP(heapRECORD *REC_HEAP, heapPOINTER PTR_POINTER, heapSIZE SIZ_SIZE, heapSIZE SIZ_ALIGNMENT) { 6 | 7 | // Starts up heap 8 | REC_HEAP->PTR_POINTER = PTR_POINTER; 9 | REC_HEAP->SIZ_SIZE = SIZ_SIZE; 10 | REC_HEAP->SIZ_ALIGNMENT = SIZ_ALIGNMENT; 11 | REC_HEAP->SIZ_FULL = 0; 12 | } 13 | 14 | // Heap allocate method - If pointer is not null and force flag is false, keeps it unchanged 15 | void HEAP_ALLOCATE(heapRECORD *REC_HEAP, heapPOINTER *PTR_POINTER, heapSIZE SIZ_LENGTH, BOOLEAN_TYPE FORCE) { 16 | UINTBASE_TYPE *PTR_CLEAR; 17 | 18 | // Verifies allocation 19 | if ((*PTR_POINTER != null) && (!FORCE)) { 20 | return; 21 | } 22 | 23 | // Nulls pointer 24 | *PTR_POINTER = null; 25 | 26 | // Verifies length 27 | if (SIZ_LENGTH == 0) { 28 | return; 29 | } 30 | 31 | // Verifies alignment 32 | if (((UINTPOINTER_TYPE) &REC_HEAP->PTR_POINTER[REC_HEAP->SIZ_FULL]) % REC_HEAP->SIZ_ALIGNMENT > 0) { 33 | REC_HEAP->SIZ_FULL += (REC_HEAP->SIZ_ALIGNMENT - (((UINTPOINTER_TYPE) &REC_HEAP->PTR_POINTER[REC_HEAP->SIZ_FULL]) % REC_HEAP->SIZ_ALIGNMENT)); 34 | } 35 | 36 | // Verifies full size 37 | if (REC_HEAP->SIZ_FULL + SIZ_LENGTH - 1 >= REC_HEAP->SIZ_SIZE) { 38 | return; 39 | } 40 | 41 | // Clears memory 42 | for (PTR_CLEAR = (UINTBASE_TYPE *) &REC_HEAP->PTR_POINTER[REC_HEAP->SIZ_FULL]; (UINTPOINTER_TYPE) PTR_CLEAR < ((UINTPOINTER_TYPE) &REC_HEAP->PTR_POINTER[REC_HEAP->SIZ_FULL] + SIZ_LENGTH); PTR_CLEAR++) { 43 | *PTR_CLEAR = null; 44 | } 45 | 46 | // Prepares address 47 | *PTR_POINTER = &REC_HEAP->PTR_POINTER[REC_HEAP->SIZ_FULL]; 48 | 49 | // Calculates full size 50 | REC_HEAP->SIZ_FULL += SIZ_LENGTH; 51 | } 52 | -------------------------------------------------------------------------------- /ARINC653/arinc653_configuration.c: -------------------------------------------------------------------------------- 1 | // ARINC653 includes 2 | #include "arinc653_core.h" 3 | 4 | // Get partition configuration method 5 | PARTITION_CONFIGURATION_TYPE *CONFIGURATION_GETPARTITIONCONFIGURATION(PARTITION_NAME_TYPE PARTITION_NAME) { 6 | MODULE_INFORMATION_TYPE *MODULE_INFORMATION; 7 | INDEX_TYPE CONFIGURATION_PARTITION_INDEX; 8 | 9 | // Gets module information 10 | MODULE_INFORMATION = _CORE_MODULE_INFORMATION; 11 | 12 | // Iterates partitions 13 | for (CONFIGURATION_PARTITION_INDEX = 0; CONFIGURATION_PARTITION_INDEX < MODULE_INFORMATION->MODULE_CONFIGURATION->PARTITION_CONFIGURATION_SIZE; CONFIGURATION_PARTITION_INDEX++) { 14 | 15 | // Compares names 16 | if (COMMON_COMPARESTRINGS(PARTITION_NAME, MODULE_INFORMATION->MODULE_CONFIGURATION->PARTITION_CONFIGURATION[CONFIGURATION_PARTITION_INDEX].NAME, MAX_NAME_LENGTH)) { 17 | 18 | // Returns partition configuration 19 | return &MODULE_INFORMATION->MODULE_CONFIGURATION->PARTITION_CONFIGURATION[CONFIGURATION_PARTITION_INDEX]; 20 | } 21 | } 22 | 23 | // Partition not found 24 | return null; 25 | } 26 | 27 | // Get process configuration method 28 | PROCESS_CONFIGURATION_TYPE *CONFIGURATION_GETPROCESSCONFIGURATION(PARTITION_CONFIGURATION_TYPE *PARTITION_CONFIGURATION, PROCESS_NAME_TYPE PROCESS_NAME) { 29 | INDEX_TYPE CONFIGURATION_PROCESS_INDEX; 30 | 31 | // Iterates processes 32 | for (CONFIGURATION_PROCESS_INDEX = 0; CONFIGURATION_PROCESS_INDEX < PARTITION_CONFIGURATION->PROCESS_CONFIGURATION_SIZE; CONFIGURATION_PROCESS_INDEX++) { 33 | 34 | // Compares names 35 | if (COMMON_COMPARESTRINGS(PROCESS_NAME, PARTITION_CONFIGURATION->PROCESS_CONFIGURATION[CONFIGURATION_PROCESS_INDEX].NAME, MAX_NAME_LENGTH)) { 36 | 37 | // Returns process configuration 38 | return &PARTITION_CONFIGURATION->PROCESS_CONFIGURATION[CONFIGURATION_PROCESS_INDEX]; 39 | } 40 | } 41 | 42 | // Process not found 43 | return null; 44 | } 45 | -------------------------------------------------------------------------------- /Hardware/README.txt: -------------------------------------------------------------------------------- 1 | This folder's files were mainly obtained from TI's AM335X StarterWare (https://sourceforge.net/p/starterwarefree/code/ci/master/tree/). 2 | 3 | Changes and new implementations were performed as follows. 4 | 5 | - Files specifically targeted to BeagleBone had "_bb" appended to their names. 6 | - Files "usbdhidjoystick.c" and "usbdhidjoystick.h" were included as an example for using usblib. 7 | - File "debug.c" added to implement the "__error__" debug function. 8 | - The "hw_types.h" include at "pruss.c" had its path fixed. 9 | - Changes in "cp15.asm" and "cp15.h": 10 | - Added functions "CP15Ttbr0Set" and "CP15Ttbr1Set". 11 | - Added function "CP15Ttb1Set". 12 | - Added function "CP15SetContextID". 13 | - Function "CP15TtbCtlTtb0Config" was renamed to "CP15TtbCtlConfig", and had the N value added as a parameter. 14 | - Changes in "cpsw.c" and "cpsw.h": 15 | - Added function "CPSWCPDMATxHdrDescPtrRead". 16 | - Added function "CPSWCPDMARxHdrDescPtrRead". 17 | - Variable "fnRAMVectors" in "interrupt.c" was renamed to "IRQHandlerVectorTable". 18 | - Defined "USB_EP_TO_INDEX" in "usb.h". 19 | - Fixed assertion in "usb.c". 20 | - Added function "TSCADCModuleClkConfig" in "tsc_adc.h". 21 | - Added function "TSCADCFIFOADCDataStepIDRead" in "tsc_adc.c" and "tsc_adc.h". 22 | - The "init.asm" file was not included. 23 | - Files "mmu.c" and "mmu.h" were not included. 24 | - Added functions "UARTConsolePutc" and "UARTConsoleGetcTimeout" in "uartStdio.h". 25 | - Added file "pwmss.h" to give access to functions: 26 | PWMSSModuleClkConfig 27 | PWMSSTBClkEnable 28 | - Added the following functions to "dcan.h": 29 | DCANPinMuxSetUp 30 | DCANMsgRAMInit 31 | DCANModuleClkConfig 32 | - Commented definition of "DELAY_USE_INTERRUPTS" in "sysdelay_bb.c". 33 | - In function "DCANPinMuxSetUp" within "dcan_bb.c": 34 | - Removed board-specific behavior 35 | - Set to use instance DCAN1 instead of DCAN0 36 | - In function "UARTPinMuxSetup" within "uart_bb.c", added support to the instance UART1. 37 | - Implemented function "UARTConsoleGetcTimeout" in "uartConsole_bb.c". -------------------------------------------------------------------------------- /Library/usblib/usbdata.c: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // usbdata.c - Data definitions related to USB stack. 4 | // 5 | // Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of AM1808 Sitaraware USB Library and reused from revision 6288 22 | // of the Stellaris USB Library. 23 | // 24 | //***************************************************************************** 25 | 26 | #include 27 | #include "hw_types.h" 28 | #include "usblib.h" 29 | 30 | //***************************************************************************** 31 | // 32 | // Flag to indicate whether or not we have been initialized. 33 | // 34 | //***************************************************************************** 35 | tUSBInstanceObject g_USBInstance[USB_NUM_INSTANCE]; 36 | 37 | tUSBPerfInfo g_USBPerfInfo[5000]; 38 | unsigned int ulPerfInfoCounter=0; 39 | unsigned int fReadEnabled=0; 40 | unsigned int fWriteEnabled=0; 41 | unsigned int fUSBDisconnected = 0; 42 | 43 | 44 | //***************************************************************************** 45 | // 46 | // Close the Doxygen group. 47 | //! @} 48 | // 49 | //***************************************************************************** 50 | -------------------------------------------------------------------------------- /ARINC653/include/arinc653_priorityqueue.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_PRIORITYQUEUE_H_ 2 | #define ARINC653_PRIORITYQUEUE_H_ 3 | 4 | // Priority 5 | typedef portUINT64 priorityqueuePRIORITY; 6 | 7 | // Value 8 | typedef portUINT64 priorityqueueVALUE; 9 | 10 | // Size 11 | typedef portSIZE priorityqueueSIZE; 12 | 13 | // Entry 14 | struct _priorityqueueENTRY { 15 | priorityqueuePRIORITY PRI_PRIORITY; 16 | priorityqueueVALUE VAL_VALUE; 17 | struct _priorityqueueRECORD *REC_ENQUEUED; 18 | struct _priorityqueueENTRY *ENT_NEXT; 19 | struct _priorityqueueENTRY *ENT_PREVIOUS; 20 | }; 21 | typedef struct _priorityqueueENTRY priorityqueueENTRY; 22 | 23 | // Record 24 | struct _priorityqueueRECORD { 25 | struct _priorityqueueENTRY *ENT_HEAD; 26 | priorityqueueSIZE SIZ_COUNT; 27 | BOOLEAN_TYPE PRIORITIZED; 28 | BOOLEAN_TYPE ASCENDING; 29 | }; 30 | typedef struct _priorityqueueRECORD priorityqueueRECORD; 31 | 32 | // Empty verifier 33 | #define PRIORITYQUEUE_ISEMPTY(_REC_PRIORITYQUEUE) ((_REC_PRIORITYQUEUE)->SIZ_COUNT == 0) 34 | 35 | // Prioritized verifier 36 | #define PRIORITYQUEUE_ISPRIORITIZED(_REC_PRIORITYQUEUE) ((_REC_PRIORITYQUEUE)->PRIORITIZED) 37 | 38 | // Ascending verifier 39 | #define PRIORITYQUEUE_ISASCENDING(_REC_PRIORITYQUEUE) ((_REC_PRIORITYQUEUE)->ASCENDING) 40 | 41 | // Count getter 42 | #define PRIORITYQUEUE_GETCOUNT(_REC_PRIORITYQUEUE) ((_REC_PRIORITYQUEUE)->SIZ_COUNT) 43 | 44 | // Enqueued verifier 45 | #define PRIORITYQUEUE_ISENQUEUED(_ENT_ENTRY) ((_ENT_ENTRY)->REC_ENQUEUED != null) 46 | 47 | // Startup method 48 | void PRIORITYQUEUE_STARTUP(priorityqueueRECORD *REC_PRIORITYQUEUE, BOOLEAN_TYPE PRIORITIZED, BOOLEAN_TYPE ASCENDING); 49 | 50 | // Initialize entry method 51 | void PRIORITYQUEUE_INITIALIZEENTRY(priorityqueueENTRY *ENT_ENTRY); 52 | 53 | // Enqueue method 54 | void PRIORITYQUEUE_ENQUEUE(priorityqueueRECORD *REC_PRIORITYQUEUE, priorityqueueENTRY *ENT_ENTRY); 55 | 56 | // Remove method 57 | void PRIORITYQUEUE_REMOVE(priorityqueueENTRY *ENT_ENTRY); 58 | 59 | // Clear method 60 | void PRIORITYQUEUE_CLEAR(priorityqueueRECORD *REC_PRIORITYQUEUE, BOOLEAN_TYPE PRIORITIZED, BOOLEAN_TYPE ASCENDING); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /Hardware/timertick_bb.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file systick.c 3 | * 4 | * \brief system timer tick routines 5 | * 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #include "systick.h" 44 | 45 | void TimerTickConfigure(void (*pfnHandler)(void)) 46 | { 47 | 48 | } 49 | 50 | void TimerTickPeriodSet(unsigned int ulTime) 51 | { 52 | 53 | } 54 | 55 | void TimerTickEnable(void) 56 | { 57 | 58 | } 59 | 60 | void TimerTickDisable(void) 61 | { 62 | 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ARINC653_PORT/include/ethernet.h: -------------------------------------------------------------------------------- 1 | #ifndef ETHERNET_H_ 2 | #define ETHERNET_H_ 3 | 4 | // Includes 5 | #include "arinc653_port_types.h" 6 | #include "beaglebone.h" 7 | #include "interrupt.h" 8 | #include "mdio.h" 9 | #include "cpsw.h" 10 | #include "phy.h" 11 | 12 | // Definitions 13 | #define ETHERNET_DEFAULTINSTANCE 0 14 | #define ETHERNET_DEFAULTINSTANCEPORT 1 15 | #define ETHERNET_PACKETLENGTH_MINIMUM 60 16 | #define ETHERNET_PACKETLENGTH_MAXIMUM 1510 17 | #define ETHERNET_BUFFERLENGTH 1514 18 | 19 | // Startup method 20 | unsigned char ETHERNET_STARTUP(unsigned char POLLING_MODE); 21 | 22 | // Instance initialization method 23 | unsigned char ETHERNET_INITIALIZE_INSTANCE(unsigned int INSTANCE); 24 | 25 | // Initialize instance port method 26 | unsigned char ETHERNET_INITIALIZE_INSTANCE_PORT(unsigned int INSTANCE, unsigned int PORT, unsigned char PHY_GIGABIT, unsigned char *MAC_ADDRESS); 27 | 28 | // Auto-negotiate instance port method 29 | unsigned char ETHERNET_AUTONEGOTIATE_INSTANCE_PORT(unsigned int INSTANCE, unsigned int PORT, unsigned int TIME_OUT); 30 | 31 | // Link up instance port verification method 32 | unsigned char ETHERNET_INSTANCE_PORT_ISLINKUP(unsigned int INSTANCE, unsigned int PORT, unsigned int TIME_OUT); 33 | 34 | // Packet receiving method 35 | unsigned int ETHERNET_RECEIVEPACKET(unsigned int INSTANCE, unsigned int *PORT, unsigned char *PACKET, unsigned int LENGTH, unsigned int TIME_OUT, unsigned char ENTER_CRITICAL_SECTION); 36 | 37 | // Packet sending method 38 | unsigned char ETHERNET_SENDPACKET(unsigned int INSTANCE, unsigned int PORT, unsigned char *PACKET, unsigned int LENGTH, unsigned char ENTER_CRITICAL_SECTION); 39 | 40 | // Initialization hook 41 | extern unsigned char ETHERNET_HOOK_INITIALIZE(void); 42 | 43 | // Delay hook 44 | extern void ETHERNET_HOOK_DELAY(unsigned int MILLISECONDS); 45 | 46 | // Yield hook 47 | extern void ETHERNET_HOOK_YIELD(void); 48 | 49 | // Enter critical section hook 50 | extern void ETHERNET_HOOK_ENTERCRITICALSECTION(void); 51 | 52 | // Exit critical section hook 53 | extern void ETHERNET_HOOK_EXITCRITICALSECTION(void); 54 | 55 | // Buffer allocation hook 56 | extern unsigned int ETHERNET_HOOK_ALLOCATEBUFFER(unsigned int SIZE); 57 | 58 | // Packet reception hook 59 | extern void ETHERNET_HOOK_RECEIVEPACKET(unsigned int INSTANCE, unsigned int PORT, unsigned char *PACKET, unsigned int LENGTH); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Hardware/include/perf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file perf.h 3 | * 4 | * \brief This file contains the prototypes of the functions present in 5 | * utils/perf.c 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #ifndef _PERF_H_ 44 | #define _PERF_H_ 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | extern void PerfTimerSetup(void); 51 | extern void PerfTimerStart(void); 52 | extern unsigned int PerfTimerStop(void); 53 | 54 | /* 55 | ** External function prototypes 56 | */ 57 | extern void SysPerfTimerSetup(void); 58 | extern unsigned int SysPerfTimerConfig(unsigned int flag); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #endif 64 | 65 | 66 | -------------------------------------------------------------------------------- /Hardware/include/hw_pwmss.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file hw_pwmss.h 3 | * 4 | * \brief PWMSS register definitions 5 | */ 6 | 7 | /* 8 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 9 | */ 10 | /* 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 15 | * Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 18 | * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in the 20 | * documentation and/or other materials provided with the 21 | * distribution. 22 | * 23 | * Neither the name of Texas Instruments Incorporated nor the names of 24 | * its contributors may be used to endorse or promote products derived 25 | * from this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | */ 40 | 41 | #ifndef _HW_PWMSS_H_ 42 | #define _HW_PWMSS_H_ 43 | 44 | 45 | #define PWMSS_CLOCK_CONFIG 0x08 46 | 47 | #define PWMSS_CLOCK_STATUS 0x0C 48 | 49 | #define PWMSS_ECAP_CLK_EN_ACK_SHIFT 0x00 50 | 51 | #define PWMSS_ECAP_CLK_STOP_ACK_SHIFT 0x01 52 | 53 | #define PWMSS_EHRPWM_CLK_EN_ACK_SHIFT 0x08 54 | 55 | #define PWMSS_EHRPWM_CLK_STOP_ACK_SHIFT 0x09 56 | 57 | #define PWMSS_ECAP_CLK_EN_ACK 0x01 58 | 59 | #define PWMSS_ECAP_CLK_STOP_ACK 0x02 60 | 61 | #define PWMSS_EHRPWM_CLK_EN_ACK 0x100 62 | 63 | #define PWMSS_EHRPWM_CLK_STOP_ACK 0x200 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Hardware/include/systick.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file systick.h 3 | * 4 | * \brief This file contains the prototypes of the functions present in 5 | * utils/src/systick.c 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #ifndef _SYSTICK_H_ 44 | #define _SYSTICK_H_ 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | void SystickConfigure(void (*pfnHandler)(void)); 51 | void SystickPeriodSet(unsigned int milliSec); 52 | void SystickEnable(void); 53 | void SystickDisable(void); 54 | 55 | /* 56 | *External functions. 57 | */ 58 | extern void TimerTickConfigure(void (*pfnHandler)(void)); 59 | extern void TimerTickPeriodSet(unsigned int milliSec); 60 | extern void TimerTickEnable(void); 61 | extern void TimerTickDisable(void); 62 | 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #endif 68 | 69 | 70 | -------------------------------------------------------------------------------- /Hardware/include/delay.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file delay.h 3 | * 4 | * \brief This file contains the prototypes of the functions present in 5 | * utils/src/delay.c 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #ifndef _DELAY_H_ 44 | #define _DELAY_H_ 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | void DelayTimerSetup(void); 50 | void delay(unsigned int milliSec); 51 | void StartTimer(unsigned int millisec); 52 | void StopTimer(); 53 | unsigned int IsTimerElapsed(void); 54 | /* 55 | * External functions 56 | */ 57 | extern void SysDelayTimerSetup(void); 58 | extern void Sysdelay(unsigned int milliSec); 59 | extern void SysStartTimer(unsigned int millisec); 60 | extern void SysStopTimer(void); 61 | extern unsigned int SysIsTimerElapsed(void); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | #endif 67 | 68 | 69 | -------------------------------------------------------------------------------- /Hardware/include/pwmss.h: -------------------------------------------------------------------------------- 1 | /** ============================================================================ 2 | * \file pwmss.h 3 | * 4 | * \brief This file contains the Macros and API prototypes for pwmss driver 5 | * 6 | * ============================================================================ 7 | */ 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #ifndef _PWMSS_H_ 43 | #define _PWMSS_H_ 44 | 45 | #include "hw_pwmss.h" 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | //********************************************************************** 51 | // API FUNCTION PROTOTYPES 52 | //**********************************************************************/ 53 | 54 | void PWMSSModuleClkConfig(unsigned int instanceNum); 55 | void PWMSSTBClkEnable(unsigned int instance); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | #endif 61 | 62 | 63 | -------------------------------------------------------------------------------- /Library/usblib/include/usb-ids.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // usb-ids.h - Definitions of VIDs and PIDs used by Stellaris USB examples. 4 | // 5 | // Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 6288 of the Stellaris USB Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __USBIDS_H__ 26 | #define __USBIDS_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // TI Stellaris Vendor ID. 31 | // 32 | //***************************************************************************** 33 | #define USB_VID_STELLARIS 0x1cbe 34 | 35 | //***************************************************************************** 36 | // 37 | // Product IDs. 38 | // 39 | //***************************************************************************** 40 | #define USB_PID_MOUSE 0x0000 41 | #define USB_PID_KEYBOARD 0x0001 42 | #define USB_PID_SERIAL 0x0002 43 | #define USB_PID_BULK 0x0003 44 | #define USB_PID_SCOPE 0x0004 45 | #define USB_PID_MSC 0x0005 46 | #define USB_PID_AUDIO 0x0006 47 | #define USB_PID_COMP_SERIAL 0x0007 48 | #define USB_PID_COMP_AUDIO_HID 0x0008 49 | #define USB_PID_COMP_HID_SER 0x0009 50 | #define USB_PID_DFU 0x00FF 51 | 52 | #ifndef DEPRECATED 53 | //***************************************************************************** 54 | // 55 | // Deprecated definitions. 56 | // 57 | //***************************************************************************** 58 | #define USB_VID_LUMINARY USB_VID_STELLARIS 59 | #endif 60 | 61 | #endif /* __USBIDS_H__ */ 62 | -------------------------------------------------------------------------------- /Hardware/device.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file device.c 3 | * 4 | * \brief This file contais API to read the version of Device. 5 | */ 6 | 7 | /* 8 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 9 | */ 10 | /* 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 15 | * Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 18 | * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in the 20 | * documentation and/or other materials provided with the 21 | * distribution. 22 | * 23 | * Neither the name of Texas Instruments Incorporated nor the names of 24 | * its contributors may be used to endorse or promote products derived 25 | * from this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | */ 40 | 41 | #include "hw_control_AM335x.h" 42 | #include "soc_AM335x.h" 43 | #include "hw_types.h" 44 | #include "device.h" 45 | 46 | /**************************************************************************** 47 | ** FUNCTION DEFNITION 48 | ****************************************************************************/ 49 | unsigned int DeviceVersionGet(void) 50 | { 51 | unsigned int deviceVersion; 52 | 53 | deviceVersion = (HWREG(SOC_CONTROL_REGS + CONTROL_DEVICE_ID) >> 54 | CONTROL_DEVICE_ID_DEVREV_SHIFT); 55 | 56 | return deviceVersion; 57 | } 58 | 59 | /* Read the device OPP support from EFUSE SMA control register */ 60 | unsigned int SysConfigOppDataGet(void) 61 | { 62 | return (HWREG(SOC_CONTROL_REGS + CONTROL_EFUSE_SMA) & EFUSE_OPP_MASK); 63 | 64 | } 65 | -------------------------------------------------------------------------------- /Hardware/include/ascii.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file ascii.h 3 | * 4 | * \brief This file contains the prototypes of the functions present in 5 | * utils/ascii.c 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #ifndef _ASCII_H_ 43 | #define _ASCII_H_ 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | enum { 50 | BASE_DECIMAL = 10, 51 | BASE_HEXADECIMAL = 16, 52 | }; 53 | 54 | extern unsigned char ASCIIToDigit(unsigned char byte, unsigned int base); 55 | extern unsigned char DigitToASCII(unsigned char byte, unsigned int base); 56 | extern unsigned int StrToEthrAddr(unsigned char *strInput, 57 | unsigned char *ethAddr); 58 | extern unsigned int EthrAddrToStr(unsigned char *ethrAddrInput, 59 | unsigned char *strOutput); 60 | extern unsigned int TimeToStr(unsigned int timeInput, unsigned char *strOutput); 61 | extern unsigned int DateToStr(unsigned int dateInput, unsigned char *strOutput); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | #endif 67 | -------------------------------------------------------------------------------- /Hardware/include/cpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file cpu.h 3 | * 4 | * \brief CPU related function prototypes 5 | * 6 | * This file contains the API prototypes for configuring CPU 7 | */ 8 | 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | #ifndef __CPU_H 44 | #define __CPU_H 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | /***************************************************************************** 50 | ** FUNCTION PROTOTYPES 51 | *****************************************************************************/ 52 | extern void CPUSwitchToUserMode(void); 53 | extern void CPUSwitchToPrivilegedMode(void); 54 | 55 | /****************************************************************************/ 56 | /* 57 | ** Functions used internally 58 | */ 59 | extern void CPUAbortHandler(void); 60 | extern void CPUirqd(void); 61 | extern void CPUirqe(void); 62 | extern void CPUfiqd(void); 63 | extern void CPUfiqe(void); 64 | extern unsigned int CPUIntStatus(void); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | #endif /* __CPU_H__ */ 70 | -------------------------------------------------------------------------------- /AM335x_PRU_ICSS.gel: -------------------------------------------------------------------------------- 1 | //---------------------- 2 | // GEL file for AM335x EVM -- PRU-ICSS 3 | // rev 1.1 4 | // 5 | 6 | //******************************************************************** 7 | // The hardware modules and descriptions referred to in this document 8 | // are *NOT SUPPORTED* by Texas Instruments (www.ti.com / e2e.ti.com). 9 | // 10 | // These materials are intended for do-it-yourself (DIY) users who want 11 | // to use the PRU at their own risk without TI support. "Community" 12 | // support is offered at BeagleBoard.org/discuss. 13 | //******************************************************************** 14 | 15 | menuitem "PRU_ICSS" 16 | 17 | hotmenu PRU_ICSS_Init() 18 | { 19 | PRU_ICSS_PRCM_Enable_Step1(); 20 | PRU_ICSS_PRCM_Reset(); 21 | GEL_MemoryFill(0x4a300000, 0, 16*1024, 0x0, 0xC); 22 | GEL_MemoryFill(0x4a310000, 0, 12*1024, 0x0, 0xC); 23 | 24 | } 25 | 26 | hotmenu PRU_ICSS_PRCM_Enable_Step1() 27 | { 28 | GEL_TextOut("\t**** PRU-ICSS PRCM Enable Step 1 is in progress **** \n","Output",1,1,1); 29 | *((unsigned int*) 0x44E00C00) |= 0x2; 30 | *((unsigned int*) 0x44E00C00) &= 0xFFFFFFFD; 31 | GEL_TextOut("\t**** PRU-ICSS PRCM Enable Step 1 is Done **** \n","Output",1,1,1); 32 | 33 | GEL_TextOut("\t**** PRU-ICSS PRCM Enable Step 2 is in progress **** \n","Output",1,1,1); 34 | *((unsigned int*) 0x44E000E8) |= 0x2; 35 | 36 | GEL_TextOut("\t**** PRU-ICSS PRCM Enable Step 2 is Done **** \n","Output",1,1,1); 37 | } 38 | 39 | hotmenu PRU_ICSS_PRCM_Reset() 40 | { 41 | /*Incase Memory Map was not defined*/ 42 | 43 | GEL_TextOut("\t**** PRU-ICSS PRCM Reset is in progress **** \n","Output",1,1,1); 44 | *((unsigned int*) 0x44E00C00) |= 0x2; 45 | *((unsigned int*) 0x44E00C00) &= 0xFFFFFFFD; 46 | GEL_TextOut("\t**** PRU-ICSS PRCM Reset is Done **** \n","Output",1,1,1); 47 | 48 | } 49 | 50 | hotmenu PRU_ICSS_PRUcore0_SoftReset() 51 | { 52 | GEL_TextOut("\t**** PRU-ICSS PRU0 Reset is in progress **** \n","Output",1,1,1); 53 | *((unsigned int*) 0x4A322000) &= 0xFFFFFFFE; 54 | GEL_TextOut("\t**** PRU-ICSS PRU0 Reset is Done **** \n","Output",1,1,1); 55 | 56 | } 57 | 58 | hotmenu PRU_ICSS_PRUcore1_SoftReset() 59 | { 60 | GEL_TextOut("\t**** PRU-ICSS PRU1 Soft Reset is in progress **** \n","Output",1,1,1); 61 | *((unsigned int*) 0x4A324000) &= 0xFFFFFFFE; 62 | GEL_TextOut("\t**** PRU-ICSS PRU1 Soft Reset is Done **** \n","Output",1,1,1); 63 | 64 | } 65 | 66 | hotmenu PRU_ICSS_PRUcore0_and_1_Start() 67 | { 68 | GEL_TextOut("\t**** PRU-ICSS PRU0&1 is being started **** \n","Output",1,1,1); 69 | *((unsigned int*) 0x4A324000) = 0xB; 70 | *((unsigned int*) 0x4A322000) = 0xB; 71 | } 72 | 73 | hotmenu PRU_ICSS_PRUcore0_and_1_Halt() 74 | { 75 | GEL_TextOut("\t**** PRU-ICSS PRU0&1 is being Halted **** \n","Output",1,1,1); 76 | *((unsigned int*) 0x4A324000) = 0; 77 | *((unsigned int*) 0x4A322000) = 0; 78 | } 79 | -------------------------------------------------------------------------------- /Library/usblib/include/usbhhidmouse.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // usbhhidmouse.h - This file holds the application interfaces for USB 4 | // mouse devices. 5 | // 6 | // Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved. 7 | // Software License Agreement 8 | // 9 | // Texas Instruments (TI) is supplying this software for use solely and 10 | // exclusively on TI's microcontroller products. The software is owned by 11 | // TI and/or its suppliers, and is protected under applicable copyright 12 | // laws. You may not combine this software with "viral" open-source 13 | // software in order to form a larger program. 14 | // 15 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 16 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 17 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 19 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 20 | // DAMAGES, FOR ANY REASON WHATSOEVER. 21 | // 22 | // This is part of AM1808 StarterWare USB Library, modified resused from revision 6288 of the 23 | // stellaris USB Library. 24 | // 25 | //***************************************************************************** 26 | 27 | #ifndef __USBHHIDMOUSE_H__ 28 | #define __USBHHIDMOUSE_H__ 29 | 30 | //***************************************************************************** 31 | // 32 | // If building with a C++ compiler, make all of the definitions in this header 33 | // have a C binding. 34 | // 35 | //***************************************************************************** 36 | #ifdef __cplusplus 37 | extern "C" 38 | { 39 | #endif 40 | 41 | //***************************************************************************** 42 | // 43 | //! \addtogroup usblib_host_device 44 | //! @{ 45 | // 46 | //***************************************************************************** 47 | 48 | extern unsigned int USBHMouseOpen(unsigned int ulIndex, 49 | tUSBCallback pfnCallback, 50 | unsigned char *pucBuffer, 51 | unsigned int ulBufferSize); 52 | extern unsigned int USBHMouseClose(unsigned int ulInstance); 53 | extern unsigned int USBHMouseInit(unsigned int ulInstance); 54 | 55 | //***************************************************************************** 56 | // 57 | //! @} 58 | // 59 | //***************************************************************************** 60 | 61 | //***************************************************************************** 62 | // 63 | // Mark the end of the C bindings section for C++ compilers. 64 | // 65 | //***************************************************************************** 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /Hardware/perf.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file perf.c 3 | * 4 | * \brief This file contains APIs for measuring performance using 5 | * DMTimer. 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #include "perf.h" 43 | 44 | /**************************************************************************** 45 | ** FUNCTION DEFINITION 46 | ****************************************************************************/ 47 | /** 48 | * \brief This function configures a DMTimer instance for performance 49 | * measurement. 50 | * 51 | * \param None 52 | * 53 | * \return None. 54 | * 55 | */ 56 | void PerfTimerSetup(void) 57 | { 58 | SysPerfTimerSetup(); 59 | } 60 | 61 | /** 62 | * \brief This function starts performance timer 63 | * 64 | * \param None 65 | * 66 | * \return None 67 | */ 68 | void PerfTimerStart(void) 69 | { 70 | SysPerfTimerConfig(1); 71 | } 72 | 73 | /** 74 | * \brief This function stops performance timer and returns the time 75 | * elapsed in number of ticks 76 | * 77 | * \param None 78 | * 79 | * \return Time elapsed in ticks 80 | */ 81 | unsigned int PerfTimerStop(void) 82 | { 83 | return (SysPerfTimerConfig(0)); 84 | } 85 | 86 | 87 | -------------------------------------------------------------------------------- /Instruments/measure.c: -------------------------------------------------------------------------------- 1 | // General includes 2 | #include "measure.h" 3 | 4 | // Global variables 5 | portBOOLEAN MEASURE_RUNNING; 6 | portUINT32 MEASURE_VALUE; 7 | portUINTBASE MEASURE_CONTEXTID; 8 | 9 | // Measure startup method 10 | void MEASURE_STARTUP(void) { 11 | 12 | // Initializes state 13 | MEASURE_RUNNING = false; 14 | MEASURE_VALUE = 0; 15 | 16 | // Enables clocks for DMTimer 17 | DMTimer3ModuleClkConfig(); 18 | 19 | // Configures DMTimer 20 | DMTimerModeConfigure(SOC_DMTIMER_3_REGS, DMTIMER_ONESHOT_NOCMP_ENABLE); 21 | } 22 | 23 | // Measure starting method 24 | inline portBOOLEAN MEASURE_START(portUINTBASE CONTEXTID) { 25 | 26 | // Verifies running flag 27 | if (MEASURE_RUNNING) { 28 | return false; 29 | } 30 | 31 | // Disables DMTimer 32 | DMTimerDisable(SOC_DMTIMER_3_REGS); 33 | 34 | // Loads initial value 35 | DMTimerCounterSet(SOC_DMTIMER_3_REGS, 0); 36 | 37 | // Sets context identifier 38 | MEASURE_CONTEXTID = CONTEXTID; 39 | 40 | // Sets running flag 41 | MEASURE_RUNNING = true; 42 | 43 | #ifdef MEASURE_SUPPRESSOTHERCONTEXTS 44 | // Verifies current context identifier 45 | if (_CORE_CURRENT_CONTEXT->IDENTIFIER == MEASURE_CONTEXTID) { 46 | 47 | // Enables DMTimer 48 | DMTimerEnable(SOC_DMTIMER_3_REGS); 49 | } 50 | #else 51 | // Enables DMTimer 52 | DMTimerEnable(SOC_DMTIMER_3_REGS); 53 | #endif 54 | 55 | // Start executed 56 | return true; 57 | } 58 | 59 | // Measure pausing method 60 | void MEASURE_PAUSE(void) { 61 | 62 | // Verifies measurement running flag 63 | if (!MEASURE_RUNNING) { 64 | return; 65 | } 66 | 67 | // Disables DMTimer 68 | DMTimerDisable(SOC_DMTIMER_3_REGS); 69 | } 70 | 71 | // Measure resuming method 72 | inline void MEASURE_RESUME(void) { 73 | 74 | // Verifies measurement running flag 75 | if (!MEASURE_RUNNING) { 76 | return; 77 | } 78 | 79 | #ifdef MEASURE_SUPPRESSOTHERCONTEXTS 80 | // Verifies current context identifier 81 | if (_CORE_CURRENT_CONTEXT->IDENTIFIER == MEASURE_CONTEXTID) { 82 | 83 | // Enables DMTimer 84 | DMTimerEnable(SOC_DMTIMER_3_REGS); 85 | } 86 | #else 87 | // Enables DMTimer 88 | DMTimerEnable(SOC_DMTIMER_3_REGS); 89 | #endif 90 | } 91 | 92 | // Measure stopping method 93 | inline void MEASURE_STOP(void) { 94 | unsigned int VALUE; 95 | 96 | // Reads counter 97 | VALUE = DMTimerCounterGet(SOC_DMTIMER_3_REGS); 98 | 99 | // Disables DMTimer 100 | DMTimerDisable(SOC_DMTIMER_3_REGS); 101 | 102 | // Verifies running flag 103 | if (!MEASURE_RUNNING) { 104 | return; 105 | } 106 | 107 | // Stores measured value 108 | MEASURE_VALUE = VALUE; 109 | } 110 | 111 | // Measure reading method 112 | inline portUINT32 MEASURE_READ(void) { 113 | unsigned int VALUE; 114 | 115 | // Stores value 116 | VALUE = MEASURE_VALUE; 117 | 118 | // Resets state 119 | MEASURE_RUNNING = false; 120 | MEASURE_VALUE = 0; 121 | 122 | // Returns value 123 | return VALUE; 124 | } 125 | -------------------------------------------------------------------------------- /Hardware/include/consoleUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file consoleUtils.h 3 | * 4 | * \brief This file contains the prototypes of the generic Console 5 | * utility functions defined in utils/consoleUtils.c which allow 6 | * user to configure the console type and redirect the I/O 7 | * operations to the selected console Type. 8 | * 9 | */ 10 | 11 | /* 12 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 13 | */ 14 | /* 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions 17 | * are met: 18 | * 19 | * Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * 22 | * Redistributions in binary form must reproduce the above copyright 23 | * notice, this list of conditions and the following disclaimer in the 24 | * documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * Neither the name of Texas Instruments Incorporated nor the names of 28 | * its contributors may be used to endorse or promote products derived 29 | * from this software without specific prior written permission. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 36 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 37 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 38 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 39 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | * 43 | */ 44 | 45 | #ifndef _CONSOLEUTILS_H_ 46 | #define _CONSOLEUTILS_H_ 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | enum consoleUtilsType 53 | { 54 | CONSOLE_UART = 0, 55 | CONSOLE_DEBUGGER, 56 | CONSOLE_MAXTYPE 57 | }; 58 | 59 | /**************************************************************************** 60 | ** FUNCTION PROTOTYPES 61 | ****************************************************************************/ 62 | 63 | extern void ConsoleUtilsInit(); 64 | extern void ConsoleUtilsSetType(enum consoleUtilsType consoleFlag); 65 | extern void ConsoleUtilsPrintf(const char *string, ...); 66 | extern int ConsoleUtilsScanf(const char *format, ...); 67 | extern char* ConsoleUtilsGets(char *rxBuffer, int size); 68 | extern void ConsoleUtilsPuts(char *string, int size); 69 | extern void ConsoleUtilsPutChar(unsigned char byte); 70 | extern unsigned char ConsoleUtilsGetChar(void); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #endif 76 | -------------------------------------------------------------------------------- /Hardware/include/debug.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file debug.h 3 | * 4 | * \brief Macros for assisting debug of the driver library. 5 | */ 6 | 7 | /* 8 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 9 | */ 10 | /* 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 15 | * Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 18 | * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in the 20 | * documentation and/or other materials provided with the 21 | * distribution. 22 | * 23 | * Neither the name of Texas Instruments Incorporated nor the names of 24 | * its contributors may be used to endorse or promote products derived 25 | * from this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | */ 40 | 41 | 42 | #ifndef __DEBUG_H__ 43 | #define __DEBUG_H__ 44 | 45 | //***************************************************************************** 46 | // 47 | // Prototype for the function that is called when an invalid argument is passed 48 | // to an API. This is only used when doing a DEBUG build. 49 | // 50 | //***************************************************************************** 51 | extern void __error__(char *pcFilename, unsigned int ulLine); 52 | 53 | //***************************************************************************** 54 | // 55 | // The ASSERT macro, which does the actual assertion checking. Typically, this 56 | // will be for procedure arguments. 57 | // 58 | //***************************************************************************** 59 | #ifdef DEBUG 60 | #define ASSERT(expr) { \ 61 | if(!(expr)) \ 62 | { \ 63 | __error__(__FILE__, __LINE__); \ 64 | } \ 65 | } 66 | #else 67 | #define ASSERT(expr) 68 | #endif 69 | 70 | #endif // __DEBUG_H__ 71 | -------------------------------------------------------------------------------- /Hardware/include/mdio.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file mdio.h 3 | * 4 | * \brief MDIO APIs and macros. 5 | * 6 | * This file contains the driver API prototypes and macro definitions. 7 | */ 8 | 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | #ifndef __MDIO_H__ 44 | #define __MDIO_H__ 45 | 46 | #include "hw_mdio.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | /*****************************************************************************/ 52 | /* 53 | ** Structure to save CPSW context 54 | */ 55 | typedef struct mdioContext { 56 | unsigned int mdioCtrl; 57 | }MDIOCONTEXT; 58 | 59 | /* 60 | ** Prototypes for the APIs 61 | */ 62 | extern unsigned int MDIOPhyAliveStatusGet(unsigned int baseAddr); 63 | extern unsigned int MDIOPhyLinkStatusGet(unsigned int baseAddr); 64 | extern void MDIOInit(unsigned int baseAddr, unsigned int mdioInputFreq, 65 | unsigned int mdioOutputFreq); 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr, 67 | unsigned int regNum, volatile unsigned short *dataPtr); 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr, 69 | unsigned int regNum, unsigned short RegVal); 70 | extern void MDIOContextSave(unsigned int baseAddr, MDIOCONTEXT *contextPtr); 71 | extern void MDIOContextRestore(unsigned int baseAddr, MDIOCONTEXT *contextPtr); 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #endif /* __MDIO_H__ */ 76 | -------------------------------------------------------------------------------- /Hardware/include/misc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file misc.h 3 | * 4 | * \brief This file contains the prototypes of the functions present in 5 | * utils/misc.c 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #ifndef _MISC_H_ 43 | #define _MISC_H_ 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /**************************************************************************** 50 | ** MACRO DEFINITIONS 51 | ****************************************************************************/ 52 | 53 | /* 54 | ** Round-off division value to upper integer. The parameters passed for this 55 | ** macro should be greater than 1. 56 | */ 57 | #define DIV_CEIL(a,b) (((a) + (b) - 1) / (b)) 58 | 59 | /* Deprecated function - Compiler message */ 60 | #ifdef __GNUC__ 61 | #define DEPRECATED(func) func __attribute__ ((deprecated)) 62 | #else 63 | #define DEPRECATED(func) func 64 | #endif 65 | 66 | /* WFI intstruction */ 67 | #define wfi() asm(" WFI"); 68 | 69 | /**************************************************************************** 70 | ** FUNCTION DECLARATIONS 71 | ****************************************************************************/ 72 | 73 | extern unsigned short bcdAdd(unsigned char bcd1, unsigned char bcd2); 74 | extern unsigned int addTime(unsigned int time1, unsigned int time2, 75 | unsigned int *date); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif 81 | -------------------------------------------------------------------------------- /Library/usblib/include/usbhhidkeyboard.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // usbhhidkeyboard.h - This file holds the application interfaces for USB 4 | // keyboard devices. 5 | // 6 | // Copyright (c) 2008-2011 Texas Instruments Incorporated. All rights reserved. 7 | // Software License Agreement 8 | // 9 | // Texas Instruments (TI) is supplying this software for use solely and 10 | // exclusively on TI's microcontroller products. The software is owned by 11 | // TI and/or its suppliers, and is protected under applicable copyright 12 | // laws. You may not combine this software with "viral" open-source 13 | // software in order to form a larger program. 14 | // 15 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 16 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 17 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 19 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 20 | // DAMAGES, FOR ANY REASON WHATSOEVER. 21 | // 22 | // This is part of revision 8049 of the Stellaris USB Library. 23 | // 24 | //***************************************************************************** 25 | 26 | #ifndef __USBHHIDKEYBOARD_H__ 27 | #define __USBHHIDKEYBOARD_H__ 28 | 29 | //***************************************************************************** 30 | // 31 | // If building with a C++ compiler, make all of the definitions in this header 32 | // have a C binding. 33 | // 34 | //***************************************************************************** 35 | #ifdef __cplusplus 36 | extern "C" 37 | { 38 | #endif 39 | 40 | //***************************************************************************** 41 | // 42 | //! \addtogroup usblib_host_device 43 | //! @{ 44 | // 45 | //***************************************************************************** 46 | 47 | extern unsigned int USBHKeyboardOpen(unsigned int ulIndex, 48 | tUSBCallback pfnCallback, 49 | unsigned char *pucBuffer, 50 | unsigned int ulBufferSize); 51 | extern unsigned int USBHKeyboardClose(unsigned int ulInstance); 52 | extern unsigned int USBHKeyboardInit(unsigned int ulInstance); 53 | extern unsigned int USBHKeyboardModifierSet(unsigned int ulInstance, 54 | unsigned int ulModifiers); 55 | extern unsigned int USBHKeyboardPollRateSet(unsigned int ulInstance, 56 | unsigned int ulPollRate); 57 | 58 | extern unsigned int USBHKeyboardUsageToChar( 59 | unsigned int ulInstance, 60 | const tHIDKeyboardUsageTable *pTable, 61 | unsigned char ucUsageID); 62 | 63 | //***************************************************************************** 64 | // 65 | //! @} 66 | // 67 | //***************************************************************************** 68 | 69 | //***************************************************************************** 70 | // 71 | // Mark the end of the C bindings section for C++ compilers. 72 | // 73 | //***************************************************************************** 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /Hardware/board_bb.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file board.c 3 | * 4 | * \brief This file contains functions which are used to determine the version 5 | * and boardId information. 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #include "board.h" 43 | #include "beaglebone.h" 44 | #include 45 | 46 | /***************************************************************************** 47 | ** GLOBAL VARIABLE DEFINITIONS 48 | *****************************************************************************/ 49 | 50 | /***************************************************************************** 51 | ** FUNCTION DEFINITIONS 52 | *****************************************************************************/ 53 | 54 | unsigned int BoardInfoCheck(unsigned char *boardId, unsigned char *boardVer) 55 | { 56 | if(!(strcmp(BBB_BOARD_NAME, (char *)boardId))) 57 | { 58 | if(!(strcmp(BBB_A1_VERSION, (char *)boardVer))) 59 | { 60 | return BOARD_ID_BBB_A1; 61 | } 62 | else if(!(strcmp(BBB_A2_VERSION, (char *)boardVer))) 63 | { 64 | return BOARD_ID_BBB_A2; 65 | } 66 | else if(!(strcmp(BBB_A3_VERSION, (char *)boardVer))) 67 | { 68 | return BOARD_ID_BBB_A3; 69 | } 70 | else if(!(strcmp(BBB_A5_VERSION, (char *)boardVer))) 71 | { 72 | return BOARD_ID_BBB_A5; 73 | } 74 | else if(!(strcmp(BBB_A6_VERSION, (char *)boardVer))) 75 | { 76 | return BOARD_ID_BBB_A6; 77 | } 78 | else 79 | { 80 | return BOARD_VER_UNKNOWN; 81 | } 82 | } 83 | else 84 | { 85 | return BOARD_UNKNOWN; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Hardware/include/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \file cache.h 3 | * 4 | * \brief Cache related function prototypes 5 | * 6 | * This file contains the API prototypes for configuring ARMv7a Cache. 7 | */ 8 | 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | 44 | #ifndef __CACHE_H 45 | #define __CACHE_H 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | /*****************************************************************************/ 52 | /* 53 | ** Macros which can be passed to CacheDisable/Enable APIs 54 | */ 55 | #define CACHE_ICACHE (0x01) /* Instruction cache */ 56 | #define CACHE_DCACHE (0x02) /* Data and Unified cache*/ 57 | #define CACHE_ALL (0x03) /* Instruction, Data and Unified 58 | Cache at all levels*/ 59 | 60 | /*****************************************************************************/ 61 | /* 62 | ** API prototypes 63 | */ 64 | extern void CacheEnable(unsigned int enFlag); 65 | extern void CacheDisable(unsigned int disFlag); 66 | extern void CacheInstInvalidateAll(void); 67 | extern void CacheInstInvalidateBuff(unsigned int startAddr, 68 | unsigned int numBytes); 69 | extern void CacheDataCleanInvalidateAll(void); 70 | extern void CacheDataCleanAll(void); 71 | extern void CacheDataInvalidateAll(void); 72 | extern void CacheDataCleanBuff(unsigned int startAddr, 73 | unsigned int numBytes); 74 | 75 | extern void CacheDataInvalidateBuff(unsigned int startAddr, 76 | unsigned int numBytes); 77 | 78 | extern void CacheDataCleanInvalidateBuff(unsigned int startAddr, 79 | unsigned int numBytes); 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #endif /* __CACHE_H__ */ 85 | 86 | -------------------------------------------------------------------------------- /Hardware/include/error.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file error.h 3 | * 4 | * \brief This files contains the macros for commonly used error code in 5 | * StarterWare. These error codes are not specific to any module. 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #ifndef ERROR_H__ 44 | #define ERROR_H__ 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | #include "consoleUtils.h" 51 | 52 | /* Successful completion of the functionality */ 53 | #define S_PASS (0) 54 | /* Generic failure code */ 55 | #undef E_FAIL 56 | #define E_FAIL (-1) 57 | /* Invalid parameter */ 58 | #define E_INVALID_PARAM (-2) 59 | /* Invalid operation */ 60 | #define E_INVALID_OPERATION (-3) 61 | /* Invalid index */ 62 | #define E_INVALID_INDEX (-4) 63 | /* Interrupt number not supported */ 64 | #define E_INTR_NOT_SUPP (-5) 65 | /* Instance number not supported */ 66 | #define E_INST_NOT_SUPP (-6) 67 | /* Invalid address */ 68 | #define E_INVALID_ADDR (-7) 69 | /* Invalid profile */ 70 | #define E_INVALID_PROFILE (-8) 71 | /* Invalid Chip Select */ 72 | #define E_INVALID_CHIP_SEL (-9) 73 | 74 | /* 75 | ** The input to the below macro are the macros which are defined above. 76 | ** For e.g. usage of PRINT_STATUS() will be PRINT_STATUS(E_FAIL) or 77 | ** PRINT_STATUS(S_PASS) 78 | */ 79 | /* Print the status */ 80 | #define PRINT_STATUS(x) (x >= 0) ? \ 81 | ConsoleUtilsPrintf("\r\nSuccess! Passed with status code " #x "\n") \ 82 | : ConsoleUtilsPrintf("\r\nError! Failed with status code " #x "\n") 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARINC653_ARMV7A_AM335X 2 | Bare-metal Real-Time Operating System (RTOS) for AM335X processors (BeagleBone / BeagleBone Black) based on the ARINC 653 Part 1 specification. 3 | 4 | Compiler version 5 | ---------------- 6 | 7 | The following instructions consider the use of the Code Composer Studio IDE version 10.4.0.00006. 8 | 9 | Configuration for compilation 10 | ----------------------------- 11 | 12 | - Project / Properties / General: 13 | - Variant = AM3359 [Cortex A] 14 | - Compiler version = TI v18.12.4.LTS (or equivalent) 15 | - Output format = eabi (ELF) 16 | - Device endianness = little 17 | - Linker command file = "" 18 | - Runtime support library = "" 19 | - Project / Properties / Build / ARM Compiler / Processor Options: 20 | - Target processor version = 7A8 21 | - Designate code state = 32 22 | - Specify floating point support = VFPv3 23 | - Project / Properties / Build / ARM Compiler / Include Options: 24 | - Add "${workspace_loc:/${ProjName}/Hardware/include}" 25 | - Add "${workspace_loc:/${ProjName}/ARINC653_PORT/include}" 26 | - Add "${workspace_loc:/${ProjName}/ARINC653/include}" 27 | - Add "${workspace_loc:/${ProjName}/Instruments/include}" 28 | - Add "${workspace_loc:/${ProjName}/Library/usblib/include}" if USB is to be used 29 | - Project / Properties / Build / ARM Compiler / Predefined Symbols: 30 | - Add "DEBUG" 31 | - Add "beaglebone" 32 | - Add "am335x" 33 | - Add "am3359" 34 | - Add "MEASURE" if execution times measurement is desired 35 | - Add "MEASURE_SUPPRESSTICK" if measurements shall not include time consumed by the OS in handling the tick interrupt 36 | - Add "MEASURE_SUPPRESSOTHERCONTEXTS" if measurements shall not include time consumed in contexts other than the one that requested the measurement (use only together with MEASURE_SUPPRESSTICK) 37 | - Add "TRACK" if OS-related events' tracking is desired 38 | - Add "DISABLE_BRANCHPREDICTION" if the branch prediction mechanism shall not be enabled 39 | - Add "DISABLE_INSTRUCTIONCACHE" if instruction cache shall not be enabled 40 | - Add "DISABLE_DATACACHE" if data cache shall not be enabled 41 | - Project / Properties / Build / ARM Linker / Advanced Options / Runtime Environment: 42 | - Set "Initialization model" to "" (none) 43 | - Project / Properties / Build / ARM Compiler / Advanced Options / Diagnostic Options: 44 | - Add "1557" to "Suppress diagnostic (--diag_suppress, -pds)" 45 | - Project / Properties / CCS Build / Steps / Post-build steps: 46 | - "${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${PROJECT_LOC}/${ConfigName}/${ProjName}.out" "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${CG_TOOL_ROOT}/bin/armofd.exe" "${CG_TOOL_ROOT}/bin/armhex.exe" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe" & "${PROJECT_LOC}/Tools/tiimage.exe" "0x80000000" "NONE" "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${PROJECT_LOC}/${ConfigName}/APP" & copy "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${PROJECT_LOC}/${ConfigName}/APP_XMODEM" 47 | - "${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin" "${PROJECT_LOC}/${ConfigName}/${ProjName}.out" "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${CG_TOOL_ROOT}/bin/armofd" "${CG_TOOL_ROOT}/bin/armhex" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin" && "${PROJECT_LOC}/Tools/tiimage" "0x80000000" "NONE" "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${PROJECT_LOC}/${ConfigName}/APP" && cp "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${PROJECT_LOC}/${ConfigName}/APP_XMODEM" 48 | 49 | Debugging on the target platform 50 | -------------------------------- 51 | 52 | - When the "Launching Debug Session" window is shown: 53 | - Select *only* the "CortxA8" device 54 | - Click "OK" 55 | -------------------------------------------------------------------------------- /Hardware/include/uartStdio.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file uartStdio.h 3 | * 4 | * \brief This file contains the prototypes of the functions present in 5 | * utils/src/uartStdio.c 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #ifndef _UARTSTDIO_H_ 44 | #define _UARTSTDIO_H_ 45 | 46 | #include 47 | #include "misc.h" 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /**************************************************************************** 54 | ** MACRO DEFINITIONS 55 | ****************************************************************************/ 56 | 57 | /**************************************************************************** 58 | ** FUNCTION PROTOTYPES 59 | ****************************************************************************/ 60 | 61 | extern unsigned int UARTPuts(char *pTxBuffer, int numBytesToWrite); 62 | extern char* UARTGets(char *pRxBuffer, int numBytesToRead); 63 | extern unsigned int UARTwrite(const char *pcBuf, unsigned int len); 64 | extern void UARTPutc(unsigned char byteTx); 65 | extern void UARTConsolePutc(unsigned char data); 66 | extern unsigned char UARTGetc(void); 67 | extern int UARTConsoleGetcTimeout(unsigned int timeOutVal); 68 | extern void UARTStdioInit(void); 69 | extern int UARTScanf(const char *format, va_list vaArg); 70 | extern void UARTPrintf(const char *string, va_list vaArg); 71 | 72 | /***************************************************************************** 73 | ** DEPRECATED API DECLARATIONS 74 | ******************************************************************************/ 75 | DEPRECATED(extern void UARTPutHexNum(unsigned int hexValue)); 76 | DEPRECATED(extern unsigned int UARTGetHexNum(void)); 77 | DEPRECATED(extern void UARTPutNum(int value)); 78 | DEPRECATED(extern int UARTGetNum(void)); 79 | DEPRECATED(extern void UARTprintf(const char *pcString, ...)); 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #endif 85 | -------------------------------------------------------------------------------- /Hardware/include/hw_usbphyGS70.h: -------------------------------------------------------------------------------- 1 | /** ============================================================================ 2 | * \file hw_usbphyGS70.h 3 | * 4 | * \brief This file contains the bit field values to use with the USB phy register 5 | * 6 | * ============================================================================ 7 | */ 8 | 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | 44 | #ifndef __HW_USBPHY_GS70_H__ 45 | #define __HW_USBPHY_GS70_H__ 46 | 47 | #if defined(c6a811x) 48 | #include "hw_control_C6A811x.h" 49 | #endif 50 | 51 | //***************************************************************************** 52 | // 53 | // If building with a C++ compiler, make all of the definitions in this header 54 | // have a C binding. 55 | // 56 | //***************************************************************************** 57 | #ifdef __cplusplus 58 | extern "C" 59 | { 60 | #endif 61 | 62 | /****************************************************************************** 63 | ** PHY REGISTER ADDRESS 64 | *******************************************************************************/ 65 | #if defined(am335x) 66 | #define CFGCHIP2_USBPHYCTRL (0x44E10620) 67 | #define CFGCHIP2_USB1PHYCTRL (0x44E10628) 68 | #elif defined(c6a811x) 69 | #define CFGCHIP2_USBPHYCTRL (SOC_CONTROL_REGS + CONTROL_USB_CTRL(0)) 70 | #define CFGCHIP2_USB1PHYCTRL (SOC_CONTROL_REGS + CONTROL_USB_CTRL(1)) 71 | #endif 72 | 73 | 74 | /****************************************************************************** 75 | ** BIT FIELDS TO USE WITH PHY REGISTER 76 | *******************************************************************************/ 77 | #define USBPHY_CM_PWRDN (1 << 0) 78 | #define USBPHY_OTG_PWRDN (1 << 1) 79 | #define USBPHY_OTGVDET_EN (1 << 19) 80 | #define USBPHY_OTGSESSEND_EN (1 << 20) 81 | 82 | void UsbPhyOn(unsigned int ulIndex); 83 | void UsbPhyOff(unsigned int ulIndex); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif // __HW_USBPHY_GS70_H__ 90 | -------------------------------------------------------------------------------- /Hardware/board.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file board.c 3 | * 4 | * \brief This file contains functions which is used to determine the version 5 | * and boardId information. 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #include"board.h" 43 | 44 | /***************************************************************************** 45 | ** GLOBAL VARIABLE DEFINITIONS 46 | *****************************************************************************/ 47 | 48 | unsigned char boardVersion[EEPROM_SIZE_VERSION]; 49 | unsigned char boardName[EEPROM_SIZE_BOARD_NAME]; 50 | BOARDINFO *boardData; 51 | unsigned int boardId = BOARD_UNKNOWN; 52 | 53 | /***************************************************************************** 54 | ** FUNCTION DEFINITIONS 55 | *****************************************************************************/ 56 | 57 | /* returns version of the board */ 58 | unsigned char *BoardVersionGet(void) 59 | { 60 | return boardVersion; 61 | } 62 | 63 | /* returns Name of the board */ 64 | unsigned char *BoardNameGet(void) 65 | { 66 | return boardName; 67 | } 68 | 69 | /* returns Name of the board */ 70 | unsigned int BoardIdGet(void) 71 | { 72 | return boardId; 73 | } 74 | 75 | /* Reads EEPROM and validates the board information */ 76 | unsigned int BoardInfoInit(void) 77 | { 78 | unsigned int index; 79 | unsigned char boardInfo[MAX_DATA]; 80 | 81 | BoardInfoRead(boardInfo); 82 | 83 | boardData = (BOARDINFO *)boardInfo; 84 | 85 | for(index = 0; index < (EEPROM_SIZE_VERSION - 1); index++) 86 | { 87 | boardVersion[index] = boardData->version[index]; 88 | } 89 | 90 | boardVersion[index] = '\0'; 91 | 92 | for(index = 0; index < (EEPROM_SIZE_BOARD_NAME - 1); index++) 93 | { 94 | boardName[index] = boardData->boardName[index]; 95 | } 96 | 97 | boardName[index] = '\0'; 98 | 99 | boardId = BoardInfoCheck(boardName, boardVersion); 100 | 101 | return boardId; 102 | } 103 | -------------------------------------------------------------------------------- /Hardware/include/hw_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file hw_types.h 3 | * 4 | * \brief Common type definitions and macros 5 | */ 6 | 7 | /* 8 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 9 | */ 10 | /* 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 15 | * Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 18 | * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in the 20 | * documentation and/or other materials provided with the 21 | * distribution. 22 | * 23 | * Neither the name of Texas Instruments Incorporated nor the names of 24 | * its contributors may be used to endorse or promote products derived 25 | * from this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | */ 40 | 41 | 42 | #ifndef _HW_TYPES_H_ 43 | #define _HW_TYPES_H_ 44 | 45 | //***************************************************************************** 46 | // 47 | // Define a boolean type, and values for true and false. 48 | // 49 | //***************************************************************************** 50 | typedef unsigned char tBoolean; 51 | 52 | #ifndef true 53 | #define true 1 54 | #endif 55 | 56 | #ifndef false 57 | #define false 0 58 | #endif 59 | 60 | #ifndef NULL 61 | #define NULL ((void*) 0) 62 | #endif 63 | //***************************************************************************** 64 | // 65 | // Macros for hardware access, both direct and via the bit-band region. 66 | // 67 | //***************************************************************************** 68 | #define HWREG(x) \ 69 | (*((volatile unsigned int *)(x))) 70 | #define HWREGH(x) \ 71 | (*((volatile unsigned short *)(x))) 72 | #define HWREGB(x) \ 73 | (*((volatile unsigned char *)(x))) 74 | #define HWREGBITW(x, b) \ 75 | HWREG(((unsigned int)(x) & 0xF0000000) | 0x02000000 | \ 76 | (((unsigned int)(x) & 0x000FFFFF) << 5) | ((b) << 2)) 77 | #define HWREGBITH(x, b) \ 78 | HWREGH(((unsigned int)(x) & 0xF0000000) | 0x02000000 | \ 79 | (((unsigned int)(x) & 0x000FFFFF) << 5) | ((b) << 2)) 80 | #define HWREGBITB(x, b) \ 81 | HWREGB(((unsigned int)(x) & 0xF0000000) | 0x02000000 | \ 82 | (((unsigned int)(x) & 0x000FFFFF) << 5) | ((b) << 2)) 83 | 84 | #define TRUE 1 85 | #define FALSE 0 86 | 87 | #endif // __HW_TYPES_H__ 88 | -------------------------------------------------------------------------------- /Hardware/pruss.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pruss.h" 4 | #include "hw_types.h" 5 | #include "soc_AM335x.h" 6 | 7 | /* 8 | PRU driver implementation, based on code code and documentation from 9 | https://groups.google.com/forum/#!category-topic/beagleboard/pru/rCO-2nKynVE 10 | 11 | For a description how to compile PRU code in a suitable way, please also refer 12 | to this description! 13 | */ 14 | 15 | 16 | /** 17 | * Initialise both PRUs for later usage 18 | * clkFlags: optional flags CM_PER_PRU_ICSS_CLKSTCTRL_UART_GCLK and/or CM_PER_PRU_ICSS_CLKSTCTRL_IEP_GCLK 19 | */ 20 | void PRUSSInit(unsigned int clkFlags) 21 | { 22 | volatile int i=0; 23 | 24 | // reset the PRU, this may not be necessary in case of initial start-up 25 | HWREG(SOC_PRM_PER_REGS)|=0x00000002; 26 | while ((HWREG(SOC_PRM_PER_REGS) & 0x00000002)==0); //wait until reset was done 27 | HWREG(SOC_PRM_PER_REGS)&=0xFFFFFFFD; // clear reset bit 28 | 29 | // wake-up and enable PRU, enable OCP-clock (mandatory) 30 | // UART and IEP clock have to be enabled here too when needed 31 | HWREG(SOC_CM_PER_REGS+CM_PER_PRU_ICSS_CLKCTRL)=0x00000002; 32 | HWREG(SOC_CM_PER_REGS+CM_PER_PRU_ICSS_CLKSTCTRL)=(CM_PER_PRU_ICSS_CLKSTCTRL_OCP_GCLK|clkFlags); 33 | 34 | // have a short delay before next step 35 | while (i<10000) 36 | { 37 | i++; 38 | } 39 | HWREG(PRUSS_CFG_BASE+PRUSS_CFG_BASE_SYSCFG)=(0x00000005); 40 | while ((HWREG(PRUSS_CFG_BASE+PRUSS_CFG_BASE_SYSCFG) & 0x00000020)!=0); // check wait state bit 41 | } 42 | 43 | 44 | /** 45 | * Load text and data binaries into PRU0 or PRU1 buffer and execute it. The code needs to be compiled in a way 46 | * where start address is located at address 0, to ensure this, a linker command file with following structure has 47 | * to be used for compilation of the PRU-code which forces it to always use start address 0x000: 48 | 49 | -cr 50 | -stack 0x100 51 | -heap 0x100 52 | 53 | MEMORY 54 | { 55 | PAGE 0: 56 | PRUIMEM: o = 0x00000000 l = 0x00001000 57 | PAGE 1: 58 | PRUDMEM: o = 0x00000000 l = 0x00001000 59 | } 60 | 61 | SECTIONS 62 | { 63 | GROUP: load = PRUIMEM 64 | { 65 | .text:_c_int00* : 66 | .text : 67 | } 68 | .stack > PRUDMEM, PAGE 1 69 | .bss > PRUDMEM, PAGE 1 70 | .cio > PRUDMEM, PAGE 1 71 | .const > PRUDMEM, PAGE 1 72 | .data > PRUDMEM, PAGE 1 73 | .switch > PRUDMEM, PAGE 1 74 | .sysmem > PRUDMEM, PAGE 1 75 | .cinit > PRUDMEM, PAGE 1 76 | } 77 | 78 | */ 79 | int PRUSSExecBuffer(unsigned int pruNum,void *textBuffer,unsigned int textNumBytes,void *dataBuffer,unsigned int dataNumBytes) 80 | { 81 | if (pruNum==0) 82 | { 83 | // copy text and data into PRU0 instruction and data RAM 84 | memcpy((void*)PRU0IRAM_PHYS_BASE,(void*)textBuffer,textNumBytes); 85 | if (dataBuffer) memcpy((void*)DATARAM0_PHYS_BASE,(void*)dataBuffer,dataNumBytes); 86 | 87 | // set start address and execute 88 | HWREG(PRU0CONTROL_PHYS_BASE+PRU_PHYS_BASE_CTRL)|=0x04200000; // set start address 89 | HWREG(PRU0CONTROL_PHYS_BASE+PRU_PHYS_BASE_CTRL)|=0x00000002; // execute 90 | } 91 | else if (pruNum==1) 92 | { 93 | // copy text and data into PRU0 instruction and data RAM 94 | memcpy((void*)PRU1IRAM_PHYS_BASE,(void*)textBuffer,textNumBytes); 95 | if (dataBuffer) memcpy((void*)DATARAM1_PHYS_BASE,(void*)dataBuffer,dataNumBytes); 96 | 97 | // set start address and execute 98 | HWREG(PRU1CONTROL_PHYS_BASE+PRU_PHYS_BASE_CTRL)|=0x04200000; // set start address 99 | HWREG(PRU1CONTROL_PHYS_BASE+PRU_PHYS_BASE_CTRL)|=0x00000002; // execute 100 | } 101 | else return -1; 102 | return 0; 103 | } 104 | 105 | 106 | -------------------------------------------------------------------------------- /Hardware/usbphyGS70.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file UsbphyGS70.c 3 | * 4 | * \brief This file contains AM335x USB Phy related functions. 5 | * 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #include "hw_types.h" 43 | #include "soc_AM335x.h" 44 | #include "hw_usbphyGS70.h" 45 | #include "usblib.h" 46 | #include "hw_usb.h" 47 | #include "debug.h" 48 | 49 | //***************************************************************************** 50 | // 51 | // USB instance Object 52 | // 53 | //***************************************************************************** 54 | extern tUSBInstanceObject g_USBInstance[]; 55 | 56 | 57 | /** 58 | * \brief This function will switch on the USB Phy 59 | * 60 | * 61 | * \param None 62 | * 63 | * \return None 64 | * 65 | **/ 66 | void UsbPhyOn(unsigned int ulIndex) 67 | { 68 | unsigned int usbphycfg = 0; 69 | #if defined (am335x_15x15) || defined(am335x) || defined(c6a811x) 70 | ASSERT((0==ulIndex)||(1==ulIndex)); 71 | #else 72 | ASSERT(0==ulIndex); 73 | #endif /* defined (am335x_15x15) || ... */ 74 | 75 | #ifdef USB_MODE_FULLSPEED 76 | if (0==ulIndex) 77 | HWREGB(USB0_BASE + USB_O_POWER) &= 0xdf; 78 | #if defined (am335x_15x15) || defined(am335x) || defined(c6a811x) 79 | else 80 | HWREGB(USB1_BASE + USB_O_POWER) &= 0xdf; 81 | #endif /* defined (am335x_15x15) || ... */ 82 | #endif /* USB_MODE_HS_DISABLE */ 83 | 84 | usbphycfg = HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr); 85 | usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN); 86 | usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN); 87 | 88 | HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr) = usbphycfg; 89 | } 90 | 91 | 92 | /** 93 | * \brief This function will switch off the USB Phy 94 | * 95 | * 96 | * \param None 97 | * 98 | * \return None 99 | * 100 | **/ 101 | void UsbPhyOff(unsigned int ulIndex) 102 | { 103 | unsigned int usbphycfg = 0; 104 | 105 | usbphycfg = HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr); 106 | usbphycfg |= (USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN); 107 | HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr) = usbphycfg; 108 | } 109 | 110 | -------------------------------------------------------------------------------- /Hardware/sysperf_bb.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file sysperf.c 3 | * 4 | * \brief This file contains functions that configures a DMTimer instance 5 | * for performance measurement. 6 | * 7 | */ 8 | 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | #include "soc_AM335x.h" 44 | #include "beaglebone.h" 45 | #include "interrupt.h" 46 | #include "dmtimer.h" 47 | #include "perf.h" 48 | 49 | /****************************************************************************** 50 | ** INTERNAL MACRO DEFINITIONS 51 | *******************************************************************************/ 52 | #define TIMER_INITIAL_COUNT (0xFFFFA23Fu) 53 | #define TIMER_PERF_BASE (SOC_DMTIMER_7_REGS) 54 | 55 | /****************************************************************************** 56 | ** INTERNAL VARIABLE DEFINITIONS 57 | *******************************************************************************/ 58 | static volatile unsigned int flagIsr = 1; 59 | 60 | /****************************************************************************** 61 | ** FUNCTION DEFINITIONS 62 | *******************************************************************************/ 63 | /* 64 | ** This function sets up timer for performance measurement 65 | */ 66 | void SysPerfTimerSetup(void) 67 | { 68 | /* This function will enable clocks for the DMTimer7 instance */ 69 | DMTimer7ModuleClkConfig(); 70 | 71 | DMTimerCounterSet(TIMER_PERF_BASE, 0); 72 | 73 | } 74 | 75 | /* 76 | ** Configures the performance timer to start or stop timer 77 | ** @param flag '0', stop the timer and read the value 78 | ** non-zero value to start timer 79 | ** /NOTE This function shouldnot be called when SysStartTimer, SysStopTimer, 80 | ** SysIsTimerElapsed or Sysdelay functionality is in use and vice Versa. 81 | ** Maximim Duration is 171 Sec. 82 | ** 83 | */ 84 | unsigned int SysPerfTimerConfig(unsigned int flag) 85 | { 86 | unsigned int timeInTicks = 0; 87 | 88 | if(flag) 89 | { 90 | DMTimerCounterSet(TIMER_PERF_BASE, 0); 91 | DMTimerEnable(TIMER_PERF_BASE); 92 | } 93 | else 94 | { 95 | DMTimerDisable(TIMER_PERF_BASE); 96 | timeInTicks = DMTimerCounterGet(TIMER_PERF_BASE); 97 | } 98 | 99 | return timeInTicks; 100 | } 101 | 102 | 103 | -------------------------------------------------------------------------------- /Hardware/include/board.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file board.h 3 | * 4 | * \brief This file contains the prototypes of the functions present in 5 | * utils/board.c .It also has structure declaration 6 | * which is used to interpret the data read from EEPROM. 7 | * 8 | */ 9 | 10 | /* 11 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 12 | */ 13 | /* 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * 18 | * Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 21 | * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the 24 | * distribution. 25 | * 26 | * Neither the name of Texas Instruments Incorporated nor the names of 27 | * its contributors may be used to endorse or promote products derived 28 | * from this software without specific prior written permission. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | * 42 | */ 43 | 44 | #ifndef _BOARD_H_ 45 | #define _BOARD_H_ 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | /**************************************************************************** 52 | ** MACRO DEFINITIONS 53 | ****************************************************************************/ 54 | 55 | #define EEPROM_SIZE_HEADER (4) 56 | #define EEPROM_SIZE_BOARD_NAME (8) 57 | #define EEPROM_SIZE_VERSION (5) 58 | #define EEPROM_SIZE_SERIAL_NUMBER (12) 59 | #define MAX_DATA (EEPROM_SIZE_HEADER + \ 60 | EEPROM_SIZE_BOARD_NAME + \ 61 | EEPROM_SIZE_VERSION + \ 62 | EEPROM_SIZE_SERIAL_NUMBER) 63 | 64 | #define BOARD_UNKNOWN (0xFF) 65 | #define BOARD_VER_UNKNOWN (0xFE) 66 | 67 | /**************************************************************************** 68 | ** STRUCTURE DECLARATION 69 | ****************************************************************************/ 70 | 71 | struct EEPROMData { 72 | unsigned char header[EEPROM_SIZE_HEADER]; 73 | unsigned char boardName[EEPROM_SIZE_BOARD_NAME]; 74 | unsigned char version[EEPROM_SIZE_VERSION]; 75 | unsigned char serialNumber[EEPROM_SIZE_SERIAL_NUMBER]; 76 | }; 77 | 78 | typedef struct EEPROMData BOARDINFO; 79 | extern unsigned char boardVersion[]; 80 | extern unsigned char boardName[]; 81 | extern unsigned int boardId; 82 | 83 | /**************************************************************************** 84 | ** FUNCTION PROTOTYPES 85 | ****************************************************************************/ 86 | 87 | extern unsigned int BoardInfoCheck(unsigned char *boardId, 88 | unsigned char *boardVer); 89 | extern unsigned int BoardInfoInit(void); 90 | extern unsigned int BoardIdGet(void); 91 | extern unsigned char *BoardNameGet(void); 92 | extern void BoardInfoRead(unsigned char *); 93 | extern unsigned char *BoardVersionGet(void); 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | #endif 99 | -------------------------------------------------------------------------------- /Hardware/delay.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file delay.c 3 | * 4 | * \brief This file contains APIs to configure a DMTimer instance for 5 | * operation and to generate a requested amount of delay. 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #include "delay.h" 44 | 45 | 46 | /**************************************************************************** 47 | ** FUNCTION DEFINITION 48 | ****************************************************************************/ 49 | 50 | /** 51 | * \brief This function configures a DMTimer instance for use. 52 | * 53 | * \param None 54 | * 55 | * \return None. 56 | * 57 | * \Note This a wrapper API. The actual implementation can be found in 58 | * platform specific files. 59 | */ 60 | 61 | void DelayTimerSetup(void) 62 | { 63 | SysDelayTimerSetup(); 64 | } 65 | 66 | 67 | /** 68 | * \brief This function generates a delay of specified milli-seconds. 69 | * 70 | * \param milliSec This is the number of milli-seconds of delay. 71 | * 72 | * \return None. 73 | * 74 | * \Note This a wrapper API. The actual implementation can be found in 75 | * platform specific files. 76 | * This function shouldnot be called when StartTimer, StopTimer and 77 | * IsTimerElapsed functionality is in use. 78 | */ 79 | 80 | void delay(unsigned int milliSec) 81 | { 82 | Sysdelay(milliSec); 83 | } 84 | 85 | /** 86 | * \brief This function starts the timer for millisec timeout. 87 | * 88 | * \param milliSec This is the number of milli-seconds of delay. 89 | * 90 | * \return None. 91 | */ 92 | 93 | void StartTimer(unsigned int millisec) 94 | { 95 | SysStartTimer(millisec); 96 | } 97 | 98 | /** 99 | * \brief This function starts the timer for millisec timeout. 100 | * 101 | * \param None. 102 | * 103 | * \return None. 104 | * 105 | * \NOTE delay functionality cannot be used till StopTimer is called. 106 | */ 107 | void StopTimer() 108 | { 109 | SysStopTimer(); 110 | } 111 | 112 | /** 113 | * \brief This function checks whether timer is expired for set milli secs 114 | * 115 | * \param None. 116 | * 117 | * \return None. 118 | * 119 | * \NOTE SysStartTimer has to be called prior to checking status. 120 | * delay functionality cannot be used till SysStopTimer is called. 121 | */ 122 | unsigned int IsTimerElapsed(void) 123 | { 124 | return (SysIsTimerElapsed()); 125 | } 126 | 127 | -------------------------------------------------------------------------------- /AM3359.ccxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Application/module_module.c: -------------------------------------------------------------------------------- 1 | // Module include 2 | #include "module_module.h" 3 | 4 | // Configuration include 5 | #include "configuration.h" 6 | 7 | // SNIPPET_START GLOBAL_INCLUDES 8 | // Test include 9 | #include "test.h" 10 | // SNIPPET_END 11 | 12 | // -------------------- MODULE DESCRIPTION START -------------------- 13 | // SNIPPET_START MODULE_MODULE_DESCRIPTION 14 | // SNIPPET_END 15 | // -------------------- MODULE DESCRIPTION END -------------------- 16 | 17 | // SNIPPET_START MODULE_MODULE_INCLUDES 18 | // SNIPPET_END 19 | 20 | // Core #0 entry point 21 | void (*ENTRYPOINT_CORE0)(void) = MODULE_MODULE_DEFAULTPARTITION; 22 | 23 | // Core #0 module configuration 24 | MODULE_CONFIGURATION_TYPE *MODULE_CONFIGURATION_CORE0 = &MODULE_MODULE_CONFIGURATION; 25 | 26 | // PARTITION1 partition attributes 27 | static PARTITION_ATTRIBUTE_TYPE PARTITION1_PARTITION_ATTRIBUTE = { 28 | /*NAME*/(PARTITION_NAME_TYPE) "PARTITION1", 29 | /*ENTRY_POINT*/(SYSTEM_ADDRESS_TYPE) &PARTITION1_DEFAULTPROCESS, 30 | /*STACK_SIZE*/(STACK_SIZE_TYPE) 256, 31 | /*SYSTEMPARTITION*/(BOOLEAN_TYPE) false }; 32 | 33 | // PARTITION1 partition identifier 34 | static PARTITION_ID_TYPE PARTITION1_PARTITION_ID; 35 | 36 | // PARTITION2 partition attributes 37 | static PARTITION_ATTRIBUTE_TYPE PARTITION2_PARTITION_ATTRIBUTE = { 38 | /*NAME*/(PARTITION_NAME_TYPE) "PARTITION2", 39 | /*ENTRY_POINT*/(SYSTEM_ADDRESS_TYPE) &PARTITION2_DEFAULTPROCESS, 40 | /*STACK_SIZE*/(STACK_SIZE_TYPE) 256, 41 | /*SYSTEMPARTITION*/(BOOLEAN_TYPE) false }; 42 | 43 | // PARTITION2 partition identifier 44 | static PARTITION_ID_TYPE PARTITION2_PARTITION_ID; 45 | 46 | // PARTITION3 partition attributes 47 | static PARTITION_ATTRIBUTE_TYPE PARTITION3_PARTITION_ATTRIBUTE = { 48 | /*NAME*/(PARTITION_NAME_TYPE) "PARTITION3", 49 | /*ENTRY_POINT*/(SYSTEM_ADDRESS_TYPE) &PARTITION3_DEFAULTPROCESS, 50 | /*STACK_SIZE*/(STACK_SIZE_TYPE) 256, 51 | /*SYSTEMPARTITION*/(BOOLEAN_TYPE) false }; 52 | 53 | // PARTITION3 partition identifier 54 | static PARTITION_ID_TYPE PARTITION3_PARTITION_ID; 55 | 56 | // SNIPPET_START MODULE_MODULE_GLOBAL_DEFINITIONS 57 | // SNIPPET_END 58 | 59 | // SNIPPET_START MODULE_MODULE_GLOBAL_VARIABLES 60 | // SNIPPET_END 61 | 62 | // SNIPPET_START MODULE_MODULE_FUNCTIONS 63 | // SNIPPET_END 64 | 65 | // MODULE module default partition 66 | void MODULE_MODULE_DEFAULTPARTITION(void) { 67 | RETURN_CODE_TYPE RETURN_CODE; 68 | // SNIPPET_START MODULE_MODULE_DEFAULTPARTITION_VARIABLES 69 | portBYTE COMMAND; 70 | // SNIPPET_END 71 | 72 | // Starts module up 73 | STARTUP_MODULE(&RETURN_CODE); 74 | if (RETURN_CODE != NO_ERROR) { 75 | // SNIPPET_START STARTUP_MODULE_ERROR_HANDLING_CODE 76 | while (true) { 77 | } 78 | // SNIPPET_END 79 | } 80 | 81 | // Creates PARTITION1 partition 82 | CREATE_PARTITION(&PARTITION1_PARTITION_ATTRIBUTE, &PARTITION1_PARTITION_ID, &RETURN_CODE); 83 | if (RETURN_CODE != NO_ERROR) { 84 | // SNIPPET_START CREATE_PARTITION_ERROR_HANDLING_CODE 85 | while (true) { 86 | } 87 | // SNIPPET_END 88 | } 89 | 90 | // Creates PARTITION2 partition 91 | CREATE_PARTITION(&PARTITION2_PARTITION_ATTRIBUTE, &PARTITION2_PARTITION_ID, &RETURN_CODE); 92 | if (RETURN_CODE != NO_ERROR) { 93 | // SNIPPET_START CREATE_PARTITION_ERROR_HANDLING_CODE 94 | while (true) { 95 | } 96 | // SNIPPET_END 97 | } 98 | 99 | // Creates PARTITION3 partition 100 | CREATE_PARTITION(&PARTITION3_PARTITION_ATTRIBUTE, &PARTITION3_PARTITION_ID, &RETURN_CODE); 101 | if (RETURN_CODE != NO_ERROR) { 102 | // SNIPPET_START CREATE_PARTITION_ERROR_HANDLING_CODE 103 | while (true) { 104 | } 105 | // SNIPPET_END 106 | } 107 | 108 | // SNIPPET_START MODULE_MODULE_DEFAULTPARTITION_INITIALIZATION 109 | // SNIPPET_END 110 | 111 | // Sets module mode 112 | SET_MODULE_MODE(NORMAL, &RETURN_CODE); 113 | if (RETURN_CODE != NO_ERROR) { 114 | // SNIPPET_START SET_MODULE_MODE_ERROR_HANDLING_CODE 115 | while (true) { 116 | } 117 | // SNIPPET_END 118 | } 119 | 120 | // Start of idle partition 121 | 122 | // SNIPPET_START MODULE_MODULE_IDLEPARTITION_INITIALIZATION 123 | // SNIPPET_END 124 | 125 | // Main loop 126 | while (true) { 127 | 128 | // SNIPPET_START MODULE_MODULE_IDLEPARTITION_CODE 129 | // Sets LEDs pattern 130 | TEST_LED1_OFF(); 131 | TEST_LED2_OFF(); 132 | 133 | // Handles reset command 134 | if ((CONSOLE_READ_BYTE(&COMMAND)) && (COMMAND == 0)) { 135 | PORT_RESTARTMODULE(); 136 | } 137 | // SNIPPET_END 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /Hardware/include/cp15.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file cp15.h 3 | * 4 | * \brief CP15 related function prototypes 5 | * 6 | * This file contains the API prototypes for configuring CP15 7 | */ 8 | 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | 44 | #ifndef __CP15_H 45 | #define __CP15_H 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | /*****************************************************************************/ 52 | /* 53 | ** Macros which can be passed to CP15ControlFeatureDisable/Enable APIs 54 | ** as 'features'. Any, or an OR combination of the below macros can be 55 | ** passed to disable/enable the corresponding feature. 56 | */ 57 | #define CP15_CONTROL_TEXREMAP (0x10000000) 58 | #define CP15_CONTROL_ACCESSFLAG (0x20000000) 59 | #define CP15_CONTROL_ALIGN_CHCK (0x00000002) 60 | #define CP15_CONTROL_MMU (0x00000001) 61 | 62 | /*****************************************************************************/ 63 | /* 64 | ** API prototypes 65 | */ 66 | extern void CP15Ttbr0Set(unsigned int ttbr); 67 | extern void CP15Ttbr1Set(unsigned int ttbr); 68 | extern void CP15AuxControlFeatureEnable(unsigned int enFlag); 69 | extern void CP15AuxControlFeatureDisable(unsigned int disFlag); 70 | extern void CP15DCacheCleanBuff(unsigned int bufPtr, unsigned int size); 71 | extern void CP15DCacheCleanFlushBuff(unsigned int bufPtr, unsigned int size); 72 | extern void CP15DCacheFlushBuff(unsigned int bufPtr, unsigned int size); 73 | extern void CP15ICacheFlushBuff(unsigned int bufPtr, unsigned int size); 74 | extern void CP15ICacheDisable(void); 75 | extern void CP15DCacheDisable(void); 76 | extern void CP15ICacheEnable(void); 77 | extern void CP15DCacheEnable(void); 78 | extern void CP15DCacheCleanFlush(void); 79 | extern void CP15DCacheClean(void); 80 | extern void CP15DCacheFlush(void); 81 | extern void CP15ICacheFlush(void); 82 | extern void CP15Ttb0Set(unsigned int ttb); 83 | extern void CP15Ttb1Set(unsigned int ttb); 84 | extern void CP15TlbInvalidate(void); 85 | extern void CP15SetContextID(unsigned int contextid); 86 | extern void CP15MMUDisable(void); 87 | extern void CP15MMUEnable(void); 88 | extern void CP15VectorBaseAddrSet(unsigned int addr); 89 | extern void CP15BranchPredictorInvalidate(void); 90 | extern void CP15BranchPredictionEnable(void); 91 | extern void CP15BranchPredictionDisable(void); 92 | extern void CP15DomainAccessClientSet(void); 93 | extern void CP15ControlFeatureDisable(unsigned int features); 94 | extern void CP15ControlFeatureEnable(unsigned int features); 95 | extern void CP15TtbCtlConfig(unsigned int N); 96 | extern unsigned int CP15MainIdPrimPartNumGet(void); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | #endif /* __CP15_H__ */ 102 | -------------------------------------------------------------------------------- /Hardware/systick.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file systick.c 3 | * 4 | * \brief system timer tick routines. This can be used to call a function 5 | * during specific intervels . 6 | * 7 | */ 8 | 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | 44 | #include "systick.h" 45 | 46 | /**************************************************************************** 47 | ** FUNCTION DEFINITION 48 | ****************************************************************************/ 49 | 50 | /** 51 | * \brief This function registers the periodic handler 52 | * 53 | * 54 | * 55 | * \param void (*pfnHandler)(void) This is a pointer to the periodic handler. 56 | * 57 | * 58 | * 59 | * \return None. 60 | * 61 | * \Note This a wrapper API, The Actual implementation can found in platform 62 | * specific files 63 | * 64 | * 65 | */ 66 | void SystickConfigure(void (*pfnHandler)(void)) 67 | { 68 | TimerTickConfigure(pfnHandler); 69 | } 70 | 71 | 72 | /** 73 | * \brief This function sets the period to call the Handler 74 | * 75 | * 76 | * 77 | * \param milliSec This is the number of milli seconds for the period 78 | * 79 | * 80 | * 81 | * \return None. 82 | * 83 | * \Note This a wrapper API, The Actual implementation can found in platform 84 | * specific files 85 | * 86 | * 87 | */ 88 | void SystickPeriodSet(unsigned int milliSec) 89 | { 90 | TimerTickPeriodSet(milliSec); 91 | 92 | } 93 | 94 | /** 95 | * \brief This function Enables the Systick. This has to be called 96 | * to start the periodic function which is registered 97 | * 98 | * 99 | * \param None 100 | * 101 | * 102 | * 103 | * \return None. 104 | * 105 | * \Note This a wrapper API, The Actual implementation can found in platform 106 | * specific files 107 | * 108 | * 109 | */ 110 | void SystickEnable(void) 111 | { 112 | 113 | /* Start the timer. Characters from cntArr will be sent from the ISR */ 114 | TimerTickEnable(); 115 | } 116 | 117 | /** 118 | * \brief This function Disables the Systick. This has to be called 119 | * to stop the periodic function which is registered 120 | * 121 | * 122 | * \param milliSec This is the number of milli seconds for the period 123 | * 124 | * 125 | * 126 | * \return None. 127 | * 128 | * \Note This a wrapper API, The Actual implementation can found in platform 129 | * specific files 130 | * 131 | * 132 | */ 133 | void SystickDisable(void) 134 | { 135 | TimerTickDisable(); 136 | } 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /Hardware/include/mailbox.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * \file mailbox.h 4 | * 5 | * \brief This file contains the function prototypes for Mail box access 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | #ifndef __MAIL_BOX_H__ 43 | #define __MAIL_BOX_H__ 44 | 45 | #include "hw_control_AM335x.h" 46 | #include "hw_mailbox.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /********************** MACROS ***************************/ 53 | 54 | /* User Id's */ 55 | #define MAILBOX_USER_A8 0 56 | #define MAILBOX_USER_PRU0 1 57 | #define MAILBOX_USER_PRU1 2 58 | #define MAILBOX_USER_CM3WKUP 3 59 | 60 | /* Mailbox Queue's */ 61 | #define MAILBOX_QUEUE_0 0 62 | #define MAILBOX_QUEUE_1 1 63 | #define MAILBOX_QUEUE_2 2 64 | #define MAILBOX_QUEUE_3 3 65 | #define MAILBOX_QUEUE_4 4 66 | #define MAILBOX_QUEUE_5 5 67 | #define MAILBOX_QUEUE_6 6 68 | #define MAILBOX_QUEUE_7 7 69 | 70 | #define MESSAGE_VALID 0 71 | #define MESSAGE_INVALID 1 72 | 73 | 74 | /***************************************************************************** 75 | ** FUNCTION DECLARATIONS 76 | *****************************************************************************/ 77 | 78 | /* Queue Access API's */ 79 | 80 | void MBresetMailbox(unsigned int baseAdd); 81 | 82 | void MBconfigIdleMode(unsigned int baseAdd, unsigned int idleMode); 83 | 84 | unsigned int MBgetMessage(unsigned int baseAdd, unsigned int queueId, unsigned int *msgPtr); 85 | 86 | unsigned int MBsendMessage(unsigned int baseAdd, unsigned int queueId, unsigned int msg); 87 | 88 | 89 | /* Mailbox user(hw using mailbox) access API's */ 90 | void MBenableNewMsgInt(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 91 | void MBenableQueueNotFullInt(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 92 | 93 | void MBdisableNewMsgInt(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 94 | void MBdisableQueueNotFullInt(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 95 | 96 | unsigned int MBgetNewMsgStatus(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 97 | unsigned int MBgetQueueNotFullStatus(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 98 | 99 | void MBclrNewMsgStatus(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 100 | void MBclrQueueNotFullStatus(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 101 | 102 | unsigned int MBgetRawNewMsgStatus(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 103 | unsigned int MBgetRawQueueNotFullStatus(unsigned int baseAdd, unsigned int userId, unsigned int queueId); 104 | 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif 109 | 110 | #endif 111 | 112 | -------------------------------------------------------------------------------- /Hardware/include/hw_cm_device.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * @Component: CM 5 | * 6 | * @Filename: ../../CredDataBase/prcmCRED/cm_device_cred.h 7 | * 8 | ============================================================================ */ 9 | 10 | /* 11 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 12 | */ 13 | /* 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * 18 | * Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 21 | * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the 24 | * distribution. 25 | * 26 | * Neither the name of Texas Instruments Incorporated nor the names of 27 | * its contributors may be used to endorse or promote products derived 28 | * from this software without specific prior written permission. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | * 42 | */ 43 | 44 | 45 | #ifndef _HW_CM_DEVICE_H_ 46 | #define _HW_CM_DEVICE_H_ 47 | 48 | 49 | /***********************************************************************\ 50 | * Register arrays Definition 51 | \***********************************************************************/ 52 | 53 | 54 | /***********************************************************************\ 55 | * Bundle arrays Definition 56 | \***********************************************************************/ 57 | 58 | 59 | /***********************************************************************\ 60 | * Bundles Definition 61 | \***********************************************************************/ 62 | 63 | 64 | 65 | /*************************************************************************\ 66 | * Registers Definition 67 | \*************************************************************************/ 68 | 69 | #define CM_DEVICE_CM_CLKOUT_CTRL (0x0) 70 | 71 | /**************************************************************************\ 72 | * Field Definition Macros 73 | \**************************************************************************/ 74 | 75 | /* CM_CLKOUT_CTRL */ 76 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV (0x00000038u) 77 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_SHIFT (0x00000003u) 78 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV1 (0x0u) 79 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV2 (0x1u) 80 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV3 (0x2u) 81 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV4 (0x3u) 82 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV5 (0x4u) 83 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV6 (0x5u) 84 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV7 (0x6u) 85 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2DIV_DIV8 (0x7u) 86 | 87 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2EN (0x00000080u) 88 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2EN_SHIFT (0x00000007u) 89 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2EN_DIS (0x0u) 90 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2EN_EN (0x1u) 91 | 92 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2SOURCE (0x00000007u) 93 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2SOURCE_SHIFT (0x00000000u) 94 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2SOURCE_SEL0 (0x0u) 95 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2SOURCE_SEL1 (0x1u) 96 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2SOURCE_SEL2 (0x2u) 97 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2SOURCE_SEL4 (0x3u) 98 | #define CM_DEVICE_CM_CLKOUT_CTRL_CLKOUT2SOURCE_SEL5 (0x4u) 99 | 100 | 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /Library/usblib/include/usbdevicepriv.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // usbdevicepriv.h - Private header file used to share internal variables and 4 | // function prototypes between the various device-related 5 | // modules in the USB library. This header MUST NOT be 6 | // used by application code. 7 | // 8 | // Copyright (c) 2008-2017 Texas Instruments Incorporated. All rights reserved. 9 | // Software License Agreement 10 | // 11 | // Texas Instruments (TI) is supplying this software for use solely and 12 | // exclusively on TI's microcontroller products. The software is owned by 13 | // TI and/or its suppliers, and is protected under applicable copyright 14 | // laws. You may not combine this software with "viral" open-source 15 | // software in order to form a larger program. 16 | // 17 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 18 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 19 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 21 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 22 | // DAMAGES, FOR ANY REASON WHATSOEVER. 23 | // 24 | // This is part of revision 2.1.4.178 of the Tiva USB Library. 25 | // 26 | //***************************************************************************** 27 | 28 | #ifndef __USBDEVICEPRIV_H__ 29 | #define __USBDEVICEPRIV_H__ 30 | 31 | //***************************************************************************** 32 | // 33 | // If building with a C++ compiler, make all of the definitions in this header 34 | // have a C binding. 35 | // 36 | //***************************************************************************** 37 | #ifdef __cplusplus 38 | extern "C" 39 | { 40 | #endif 41 | 42 | //***************************************************************************** 43 | // 44 | // The states for endpoint zero during enumeration. 45 | // 46 | //***************************************************************************** 47 | typedef enum 48 | { 49 | // 50 | // The USB device is waiting on a request from the host controller on 51 | // endpoint zero. 52 | // 53 | eUSBStateIdle, 54 | 55 | // 56 | // The USB device is sending data back to the host due to an IN request. 57 | // 58 | eUSBStateTx, 59 | 60 | // 61 | // The USB device is sending the configuration descriptor back to the host 62 | // due to an IN request. 63 | // 64 | eUSBStateTxConfig, 65 | 66 | // 67 | // The USB device is receiving data from the host due to an OUT 68 | // request from the host. 69 | // 70 | eUSBStateRx, 71 | 72 | // 73 | // The USB device has completed the IN or OUT request and is now waiting 74 | // for the host to acknowledge the end of the IN/OUT transaction. This 75 | // is the status phase for a USB control transaction. 76 | // 77 | eUSBStateStatus, 78 | 79 | // 80 | // This endpoint has signaled a stall condition and is waiting for the 81 | // stall to be acknowledged by the host controller. 82 | // 83 | eUSBStateStall 84 | } 85 | tEP0State; 86 | 87 | 88 | extern tDeviceInfo *g_ppsDevInfo[]; 89 | 90 | //***************************************************************************** 91 | // 92 | // Device enumeration functions provided by device/usbenum.c and called from 93 | // the interrupt handler in device/usbhandler.c 94 | // 95 | //***************************************************************************** 96 | extern tBoolean USBDeviceConfig(unsigned int ulIndex, 97 | const tConfigHeader *psConfig, 98 | const tFIFOConfig *psFIFOConfig); 99 | extern tBoolean USBDeviceConfigAlternate(unsigned int ulIndex, 100 | const tConfigHeader *psConfig, 101 | unsigned char ucInterfaceNum, 102 | unsigned char ucAlternateSetting); 103 | extern void USBDeviceResumeTickHandler(unsigned int ulIndex); 104 | 105 | //***************************************************************************** 106 | // 107 | // Mark the end of the C bindings section for C++ compilers. 108 | // 109 | //***************************************************************************** 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | 114 | #endif // __USBDEVICEPRIV_H__ 115 | -------------------------------------------------------------------------------- /Hardware/include/hw_cm_mpu.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * @Component: CM 5 | * 6 | * @Filename: ../../CredDataBase/prcmCRED/cm_mpu_cred.h 7 | * 8 | ============================================================================ */ 9 | 10 | /* 11 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 12 | */ 13 | /* 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * 18 | * Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 21 | * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the 24 | * distribution. 25 | * 26 | * Neither the name of Texas Instruments Incorporated nor the names of 27 | * its contributors may be used to endorse or promote products derived 28 | * from this software without specific prior written permission. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | * 42 | */ 43 | 44 | 45 | #ifndef _HW_CM_MPU_H_ 46 | #define _HW_CM_MPU_H_ 47 | 48 | 49 | /***********************************************************************\ 50 | * Register arrays Definition 51 | \***********************************************************************/ 52 | 53 | 54 | /***********************************************************************\ 55 | * Bundle arrays Definition 56 | \***********************************************************************/ 57 | 58 | 59 | /***********************************************************************\ 60 | * Bundles Definition 61 | \***********************************************************************/ 62 | 63 | 64 | 65 | /*************************************************************************\ 66 | * Registers Definition 67 | \*************************************************************************/ 68 | 69 | #define CM_MPU_CLKSTCTRL (0x0) 70 | #define CM_MPU_MPU_CLKCTRL (0x4) 71 | 72 | /**************************************************************************\ 73 | * Field Definition Macros 74 | \**************************************************************************/ 75 | 76 | /* CLKSTCTRL */ 77 | #define CM_MPU_CLKSTCTRL_CLKACTIVITY_MPU_CLK (0x00000004u) 78 | #define CM_MPU_CLKSTCTRL_CLKACTIVITY_MPU_CLK_SHIFT (0x00000002u) 79 | #define CM_MPU_CLKSTCTRL_CLKACTIVITY_MPU_CLK_ACT (0x1u) 80 | #define CM_MPU_CLKSTCTRL_CLKACTIVITY_MPU_CLK_INACT (0x0u) 81 | 82 | #define CM_MPU_CLKSTCTRL_CLKTRCTRL (0x00000003u) 83 | #define CM_MPU_CLKSTCTRL_CLKTRCTRL_SHIFT (0x00000000u) 84 | #define CM_MPU_CLKSTCTRL_CLKTRCTRL_HW_AUTO (0x3u) 85 | #define CM_MPU_CLKSTCTRL_CLKTRCTRL_NO_SLEEP (0x0u) 86 | #define CM_MPU_CLKSTCTRL_CLKTRCTRL_SW_SLEEP (0x1u) 87 | #define CM_MPU_CLKSTCTRL_CLKTRCTRL_SW_WKUP (0x2u) 88 | 89 | 90 | /* MPU_CLKCTRL */ 91 | #define CM_MPU_MPU_CLKCTRL_IDLEST (0x00030000u) 92 | #define CM_MPU_MPU_CLKCTRL_IDLEST_SHIFT (0x00000010u) 93 | #define CM_MPU_MPU_CLKCTRL_IDLEST_DISABLE (0x3u) 94 | #define CM_MPU_MPU_CLKCTRL_IDLEST_FUNC (0x0u) 95 | #define CM_MPU_MPU_CLKCTRL_IDLEST_IDLE (0x2u) 96 | #define CM_MPU_MPU_CLKCTRL_IDLEST_TRANS (0x1u) 97 | 98 | #define CM_MPU_MPU_CLKCTRL_MODULEMODE (0x00000003u) 99 | #define CM_MPU_MPU_CLKCTRL_MODULEMODE_SHIFT (0x00000000u) 100 | #define CM_MPU_MPU_CLKCTRL_MODULEMODE_DISABLED (0x0u) 101 | #define CM_MPU_MPU_CLKCTRL_MODULEMODE_ENABLE (0x2u) 102 | #define CM_MPU_MPU_CLKCTRL_MODULEMODE_RESERVED (0x3u) 103 | #define CM_MPU_MPU_CLKCTRL_MODULEMODE_RESERVED_1 (0x1u) 104 | 105 | #define CM_MPU_MPU_CLKCTRL_STBYST (0x00040000u) 106 | #define CM_MPU_MPU_CLKCTRL_STBYST_SHIFT (0x00000012u) 107 | #define CM_MPU_MPU_CLKCTRL_STBYST_FUNC (0x0u) 108 | #define CM_MPU_MPU_CLKCTRL_STBYST_STANDBY (0x1u) 109 | 110 | 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /Hardware/include/hw_tps65217.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @Component: PMIC 4 | * 5 | * @Filename: hw_tps65217.h 6 | * 7 | ============================================================================ */ 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #ifndef __TPS65217_H__ 44 | #define __TPS65217_H__ 45 | 46 | 47 | /* Address of TPS65217(pmic) over I2C0 */ 48 | #define PMIC_TPS65217_I2C_SLAVE_ADDR (0x24) 49 | 50 | 51 | /* Registers */ 52 | #define CHIPID 0x00 53 | #define POWER_PATH 0x01 54 | #define INTERRUPT 0x02 55 | #define CHGCONFIG0 0x03 56 | #define CHGCONFIG1 0x04 57 | #define CHGCONFIG2 0x05 58 | #define CHGCONFIG3 0x06 59 | #define WLEDCTRL1 0x07 60 | #define WLEDCTRL2 0x08 61 | #define MUXCTRL 0x09 62 | #define STATUS 0x0A 63 | #define PASSWORD 0x0B 64 | #define PGOOD 0x0C 65 | #define DEFPG 0x0D 66 | #define DEFDCDC1 0x0E 67 | #define DEFDCDC2 0x0F 68 | #define DEFDCDC3 0x10 69 | #define DEFSLEW 0x11 70 | #define DEFLDO1 0x12 71 | #define DEFLDO2 0x13 72 | #define DEFLS1 0x14 73 | #define DEFLS2 0x15 74 | #define ENABLE 0x16 75 | #define DEFUVLO 0x18 76 | #define SEQ1 0x19 77 | #define SEQ2 0x1A 78 | #define SEQ3 0x1B 79 | #define SEQ4 0x1C 80 | #define SEQ5 0x1D 81 | #define SEQ6 0x1E 82 | 83 | #define PROT_LEVEL_NONE 0x00 84 | #define PROT_LEVEL_1 0x01 85 | #define PROT_LEVEL_2 0x02 86 | 87 | #define PASSWORD_LOCK_FOR_WRITE 0x00 88 | #define PASSWORD_UNLOCK 0x7D 89 | 90 | #define DCDC_GO 0x80 91 | 92 | #define MASK_ALL_BITS 0xFF 93 | 94 | #define USB_INPUT_CUR_LIMIT_MASK 0x03 95 | #define USB_INPUT_CUR_LIMIT_100MA 0x00 96 | #define USB_INPUT_CUR_LIMIT_500MA 0x01 97 | #define USB_INPUT_CUR_LIMIT_1300MA 0x02 98 | #define USB_INPUT_CUR_LIMIT_1800MA 0x03 99 | 100 | #define DCDC_VOLT_SEL_1275MV 0x0F 101 | #define DCDC_VOLT_SEL_1200MV (0x0C) 102 | #define DCDC_VOLT_SEL_1100MV (0x08) 103 | #define DCDC_VOLT_SEL_0950MV (0x02) 104 | 105 | #define LDO_MASK 0x1F 106 | #define LDO_VOLTAGE_OUT_1_8 0x06 /*This gives a value of 1.8V, which is required in BBB */ 107 | #define LDO_VOLTAGE_OUT_3_3 0x1F 108 | 109 | #define PWR_SRC_USB_BITMASK 0x4 110 | #define PWR_SRC_AC_BITMASK 0x8 111 | 112 | #endif 113 | 114 | -------------------------------------------------------------------------------- /ARINC653/arinc653_priorityqueue.c: -------------------------------------------------------------------------------- 1 | // ARINC653 includes 2 | #include "arinc653_core.h" 3 | 4 | // Startup method 5 | void PRIORITYQUEUE_STARTUP(priorityqueueRECORD *REC_PRIORITYQUEUE, BOOLEAN_TYPE PRIORITIZED, BOOLEAN_TYPE ASCENDING) { 6 | 7 | // Initializes 8 | REC_PRIORITYQUEUE->ENT_HEAD = null; 9 | REC_PRIORITYQUEUE->SIZ_COUNT = 0; 10 | REC_PRIORITYQUEUE->PRIORITIZED = PRIORITIZED; 11 | REC_PRIORITYQUEUE->ASCENDING = ASCENDING; 12 | } 13 | 14 | // Initialize entry method 15 | void PRIORITYQUEUE_INITIALIZEENTRY(priorityqueueENTRY *ENT_ENTRY) { 16 | 17 | // Initializes 18 | ENT_ENTRY->REC_ENQUEUED = null; 19 | ENT_ENTRY->ENT_NEXT = null; 20 | ENT_ENTRY->ENT_PREVIOUS = null; 21 | } 22 | 23 | // Enqueue method 24 | void PRIORITYQUEUE_ENQUEUE(priorityqueueRECORD *REC_PRIORITYQUEUE, priorityqueueENTRY *ENT_ENTRY) { 25 | priorityqueueENTRY *ENT_ITERATOR; 26 | BOOLEAN_TYPE PRIORITY_COMPARISON; 27 | 28 | // Verifies entry 29 | if (ENT_ENTRY == null) { 30 | return; 31 | } 32 | 33 | // Verifies enqueued record 34 | if (ENT_ENTRY->REC_ENQUEUED != null) { 35 | return; 36 | } 37 | 38 | // Verifies prioritized flag 39 | if (!REC_PRIORITYQUEUE->PRIORITIZED) { 40 | 41 | // Uses minimum priority to all entries 42 | ENT_ENTRY->PRI_PRIORITY = MIN_PRIORITY_VALUE; 43 | } 44 | 45 | // Verifies head 46 | if (REC_PRIORITYQUEUE->ENT_HEAD == null) { 47 | 48 | // Enqueues 49 | REC_PRIORITYQUEUE->ENT_HEAD = ENT_ENTRY; 50 | 51 | // Sets pointers 52 | ENT_ENTRY->ENT_NEXT = null; 53 | ENT_ENTRY->ENT_PREVIOUS = null; 54 | } else { 55 | 56 | // Initializes iterator 57 | ENT_ITERATOR = REC_PRIORITYQUEUE->ENT_HEAD; 58 | 59 | // Position lookup loop 60 | while (true) { 61 | 62 | // Compares priority position 63 | PRIORITY_COMPARISON = (REC_PRIORITYQUEUE->ASCENDING ? (ENT_ENTRY->PRI_PRIORITY < ENT_ITERATOR->PRI_PRIORITY) : (ENT_ENTRY->PRI_PRIORITY > ENT_ITERATOR->PRI_PRIORITY)); 64 | 65 | // Verifies position condition 66 | if ((ENT_ITERATOR->ENT_NEXT == null) || (PRIORITY_COMPARISON)) { 67 | 68 | // Verifies priority comparison 69 | if (PRIORITY_COMPARISON) { 70 | 71 | // Enqueues 72 | ENT_ENTRY->ENT_PREVIOUS = ENT_ITERATOR->ENT_PREVIOUS; 73 | ENT_ENTRY->ENT_NEXT = ENT_ITERATOR; 74 | 75 | // Fixes references 76 | if (ENT_ITERATOR->ENT_PREVIOUS != null) { 77 | ENT_ITERATOR->ENT_PREVIOUS->ENT_NEXT = ENT_ENTRY; 78 | } 79 | ENT_ITERATOR->ENT_PREVIOUS = ENT_ENTRY; 80 | 81 | // Fixes head 82 | if (REC_PRIORITYQUEUE->ENT_HEAD == ENT_ITERATOR) { 83 | REC_PRIORITYQUEUE->ENT_HEAD = ENT_ENTRY; 84 | } 85 | } else { 86 | 87 | // Enqueues 88 | ENT_ENTRY->ENT_NEXT = ENT_ITERATOR->ENT_NEXT; 89 | ENT_ENTRY->ENT_PREVIOUS = ENT_ITERATOR; 90 | 91 | // Fixes references 92 | if (ENT_ITERATOR->ENT_NEXT != null) { 93 | ENT_ITERATOR->ENT_NEXT->ENT_PREVIOUS = ENT_ENTRY; 94 | } 95 | ENT_ITERATOR->ENT_NEXT = ENT_ENTRY; 96 | } 97 | 98 | // Breaks 99 | break; 100 | } 101 | 102 | // Moves iterator 103 | ENT_ITERATOR = ENT_ITERATOR->ENT_NEXT; 104 | } 105 | } 106 | 107 | // Counts entry 108 | REC_PRIORITYQUEUE->SIZ_COUNT++; 109 | 110 | // Sets enqueued record 111 | ENT_ENTRY->REC_ENQUEUED = REC_PRIORITYQUEUE; 112 | } 113 | 114 | // Remove method 115 | void PRIORITYQUEUE_REMOVE(priorityqueueENTRY *ENT_ENTRY) { 116 | 117 | // Verifies entry 118 | if (ENT_ENTRY == null) { 119 | return; 120 | } 121 | 122 | // Verifies enqueued record 123 | if (ENT_ENTRY->REC_ENQUEUED == null) { 124 | return; 125 | } 126 | 127 | // Verifies enqueued record 128 | if (ENT_ENTRY->REC_ENQUEUED->SIZ_COUNT == 0) { 129 | return; 130 | } 131 | 132 | // Removes entry 133 | if (ENT_ENTRY->ENT_NEXT != null) { 134 | ENT_ENTRY->ENT_NEXT->ENT_PREVIOUS = ENT_ENTRY->ENT_PREVIOUS; 135 | } 136 | if (ENT_ENTRY->ENT_PREVIOUS != null) { 137 | ENT_ENTRY->ENT_PREVIOUS->ENT_NEXT = ENT_ENTRY->ENT_NEXT; 138 | } 139 | 140 | // Fixes head 141 | if (ENT_ENTRY->REC_ENQUEUED->ENT_HEAD == ENT_ENTRY) { 142 | ENT_ENTRY->REC_ENQUEUED->ENT_HEAD = ENT_ENTRY->ENT_NEXT; 143 | } 144 | 145 | // Counts entry 146 | ENT_ENTRY->REC_ENQUEUED->SIZ_COUNT--; 147 | 148 | // Sets enqueued record 149 | ENT_ENTRY->REC_ENQUEUED = null; 150 | } 151 | 152 | // Clear method 153 | void PRIORITYQUEUE_CLEAR(priorityqueueRECORD *REC_PRIORITYQUEUE, BOOLEAN_TYPE PRIORITIZED, BOOLEAN_TYPE ASCENDING) { 154 | 155 | // Remove head loop 156 | while (REC_PRIORITYQUEUE->ENT_HEAD != null) { 157 | PRIORITYQUEUE_REMOVE(REC_PRIORITYQUEUE->ENT_HEAD); 158 | } 159 | 160 | // Reinitializes 161 | REC_PRIORITYQUEUE->ENT_HEAD = null; 162 | REC_PRIORITYQUEUE->SIZ_COUNT = 0; 163 | REC_PRIORITYQUEUE->PRIORITIZED = PRIORITIZED; 164 | REC_PRIORITYQUEUE->ASCENDING = ASCENDING; 165 | } 166 | -------------------------------------------------------------------------------- /Hardware/include/hw_cm_rtc.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * @Component: CM 5 | * 6 | * @Filename: ../../CredDataBase/prcmCRED/cm_rtc_cred.h 7 | * 8 | ============================================================================ */ 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | 44 | 45 | #ifndef _HW_CM_RTC_H_ 46 | #define _HW_CM_RTC_H_ 47 | 48 | 49 | /***********************************************************************\ 50 | * Register arrays Definition 51 | \***********************************************************************/ 52 | 53 | 54 | /***********************************************************************\ 55 | * Bundle arrays Definition 56 | \***********************************************************************/ 57 | 58 | 59 | /***********************************************************************\ 60 | * Bundles Definition 61 | \***********************************************************************/ 62 | 63 | 64 | 65 | /*************************************************************************\ 66 | * Registers Definition 67 | \*************************************************************************/ 68 | 69 | #define CM_RTC_RTC_CLKCTRL (0x0) 70 | #define CM_RTC_CLKSTCTRL (0x4) 71 | 72 | /**************************************************************************\ 73 | * Field Definition Macros 74 | \**************************************************************************/ 75 | 76 | /* RTC_CLKCTRL */ 77 | #define CM_RTC_RTC_CLKCTRL_IDLEST (0x00030000u) 78 | #define CM_RTC_RTC_CLKCTRL_IDLEST_SHIFT (0x00000010u) 79 | #define CM_RTC_RTC_CLKCTRL_IDLEST_DISABLE (0x3u) 80 | #define CM_RTC_RTC_CLKCTRL_IDLEST_FUNC (0x0u) 81 | #define CM_RTC_RTC_CLKCTRL_IDLEST_IDLE (0x2u) 82 | #define CM_RTC_RTC_CLKCTRL_IDLEST_TRANS (0x1u) 83 | 84 | #define CM_RTC_RTC_CLKCTRL_MODULEMODE (0x00000003u) 85 | #define CM_RTC_RTC_CLKCTRL_MODULEMODE_SHIFT (0x00000000u) 86 | #define CM_RTC_RTC_CLKCTRL_MODULEMODE_DISABLED (0x0u) 87 | #define CM_RTC_RTC_CLKCTRL_MODULEMODE_ENABLE (0x2u) 88 | #define CM_RTC_RTC_CLKCTRL_MODULEMODE_RESERVED (0x3u) 89 | #define CM_RTC_RTC_CLKCTRL_MODULEMODE_RESERVED_1 (0x1u) 90 | 91 | 92 | /* CLKSTCTRL */ 93 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_L4_RTC_GCLK (0x00000100u) 94 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_L4_RTC_GCLK_SHIFT (0x00000008u) 95 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_L4_RTC_GCLK_ACT (0x1u) 96 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_L4_RTC_GCLK_INACT (0x0u) 97 | 98 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_RTC_32KCLK (0x00000200u) 99 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_RTC_32KCLK_SHIFT (0x00000009u) 100 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_RTC_32KCLK_ACT (0x1u) 101 | #define CM_RTC_CLKSTCTRL_CLKACTIVITY_RTC_32KCLK_INACT (0x0u) 102 | 103 | #define CM_RTC_CLKSTCTRL_CLKTRCTRL (0x00000003u) 104 | #define CM_RTC_CLKSTCTRL_CLKTRCTRL_SHIFT (0x00000000u) 105 | #define CM_RTC_CLKSTCTRL_CLKTRCTRL_HW_AUTO (0x3u) 106 | #define CM_RTC_CLKSTCTRL_CLKTRCTRL_NO_SLEEP (0x0u) 107 | #define CM_RTC_CLKSTCTRL_CLKTRCTRL_SW_SLEEP (0x1u) 108 | #define CM_RTC_CLKSTCTRL_CLKTRCTRL_SW_WKUP (0x2u) 109 | 110 | 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /ARINC653_PORT/include/arinc653_port_types.h: -------------------------------------------------------------------------------- 1 | #ifndef ARINC653_PORT_TYPES_H_ 2 | #define ARINC653_PORT_TYPES_H_ 3 | 4 | // Includes 5 | #include "hw_types.h" 6 | #include "soc_AM335x.h" 7 | #include "hw_control_AM335x.h" 8 | 9 | // Definitions 10 | #ifndef false 11 | #define false 0 12 | #endif 13 | #ifndef true 14 | #define true 1 15 | #endif 16 | #ifndef null 17 | #define null 0 18 | #endif 19 | 20 | // Common types 21 | typedef unsigned char portBOOLEAN; 22 | typedef unsigned char portCHARACTER; 23 | typedef unsigned char portBYTE; 24 | typedef signed char portINT8; 25 | typedef unsigned char portUINT8; 26 | typedef signed short portINT16; 27 | typedef unsigned short portUINT16; 28 | typedef signed int portINT32; 29 | typedef unsigned int portUINT32; 30 | typedef signed long long int portINT64; 31 | typedef unsigned long long int portUINT64; 32 | 33 | // Base type (architecture base length integer) 34 | typedef signed int portINTBASE; 35 | typedef unsigned int portUINTBASE; 36 | 37 | // Pointer unsigned integer (pointer length unsigned integer) 38 | typedef unsigned int portUINTPOINTER; 39 | 40 | // Address 41 | typedef void *portADDRESS; 42 | 43 | // Stack row 44 | typedef unsigned int portSTACKROW; 45 | 46 | // Parameter 47 | typedef unsigned int portPARAMETER; 48 | 49 | // Size 50 | typedef unsigned int portSIZE; 51 | 52 | // Index 53 | typedef unsigned int portINDEX; 54 | 55 | // Identifier 56 | typedef unsigned int portIDENTIFIER; 57 | #define MAXIMUM_IDENTIFIER_VALUE 0xFFFFFFFF 58 | 59 | // Port context 60 | struct _PORT_CONTEXT_TYPE { 61 | // Run status registers 62 | portADDRESS PC; // R15 63 | portUINT32 CPSR; 64 | // NEON/VFP coprocessor registers 65 | portUINT64 D0; 66 | portUINT64 D1; 67 | portUINT64 D2; 68 | portUINT64 D3; 69 | portUINT64 D4; 70 | portUINT64 D5; 71 | portUINT64 D6; 72 | portUINT64 D7; 73 | portUINT64 D8; 74 | portUINT64 D9; 75 | portUINT64 D10; 76 | portUINT64 D11; 77 | portUINT64 D12; 78 | portUINT64 D13; 79 | portUINT64 D14; 80 | portUINT64 D15; 81 | portUINT64 D16; 82 | portUINT64 D17; 83 | portUINT64 D18; 84 | portUINT64 D19; 85 | portUINT64 D20; 86 | portUINT64 D21; 87 | portUINT64 D22; 88 | portUINT64 D23; 89 | portUINT64 D24; 90 | portUINT64 D25; 91 | portUINT64 D26; 92 | portUINT64 D27; 93 | portUINT64 D28; 94 | portUINT64 D29; 95 | portUINT64 D30; 96 | portUINT64 D31; 97 | portUINT32 FPSCR; 98 | portUINT32 FPEXC; 99 | // General registers 100 | portUINT32 R0; 101 | portUINT32 R1; 102 | portUINT32 R2; 103 | portUINT32 R3; 104 | portUINT32 R4; 105 | portUINT32 R5; 106 | portUINT32 R6; 107 | portUINT32 R7; 108 | portUINT32 R8; 109 | portUINT32 R9; 110 | portUINT32 R10; 111 | portUINT32 R11; 112 | portUINT32 R12; 113 | portUINT32 R13; // SP 114 | portUINT32 R14; // LR 115 | // Other information 116 | portUINT32 CONTEXT_IDENTIFIER; 117 | portADDRESS FLTRANSLATIONTABLE_ADDRESS; 118 | }; 119 | typedef struct _PORT_CONTEXT_TYPE PORT_CONTEXT_TYPE; 120 | 121 | // Port module configuration connection table sampling port mapping pseudo partition 122 | struct _PORT_MODULE_CONFIGURATION_CONNECTIONTABLE_SAMPLINGPORTMAPPING_PSEUDOPARTITION_TYPE { 123 | portCHARACTER PHYSICAL_ADDRESS[12]; 124 | }; 125 | typedef struct _PORT_MODULE_CONFIGURATION_CONNECTIONTABLE_SAMPLINGPORTMAPPING_PSEUDOPARTITION_TYPE PORT_MODULE_CONFIGURATION_CONNECTIONTABLE_SAMPLINGPORTMAPPING_PSEUDOPARTITION_TYPE; 126 | 127 | // Port module configuration connection table queuing port mapping pseudo partition 128 | struct _PORT_MODULE_CONFIGURATION_CONNECTIONTABLE_QUEUINGPORTMAPPING_PSEUDOPARTITION_TYPE { 129 | portCHARACTER PHYSICAL_ADDRESS[12]; 130 | }; 131 | typedef struct _PORT_MODULE_CONFIGURATION_CONNECTIONTABLE_QUEUINGPORTMAPPING_PSEUDOPARTITION_TYPE PORT_MODULE_CONFIGURATION_CONNECTIONTABLE_QUEUINGPORTMAPPING_PSEUDOPARTITION_TYPE; 132 | 133 | // Port module configuration 134 | struct _PORT_MODULE_CONFIGURATION_TYPE { 135 | portADDRESS VECTORTABLE_ADDRESS; 136 | portSIZE VECTORTABLE_SIZE; 137 | portADDRESS MODULE_FLTRANSLATIONTABLE_ADDRESS; 138 | portSIZE MODULE_FLTRANSLATIONTABLE_SIZE; 139 | portADDRESS MODULE_SLTRANSLATIONTABLE_ADDRESS; 140 | portSIZE MODULE_SLTRANSLATIONTABLE_SIZE; 141 | portUINTBASE *MODULE_GLOBAL_FLTRANSLATIONTABLE_ADDRESS; // Filled by the operating system 142 | portCHARACTER MODULE_NETWORK_PHYSICAL_ADDRESS[10]; 143 | }; 144 | typedef struct _PORT_MODULE_CONFIGURATION_TYPE PORT_MODULE_CONFIGURATION_TYPE; 145 | 146 | // Port system configuration 147 | struct _PORT_SYSTEM_CONFIGURATION_TYPE { 148 | portADDRESS STACK_AREA_START_ADDRESS; 149 | portADDRESS STACK_AREA_END_ADDRESS; 150 | portADDRESS PERIPHERALS_ADDRESS; 151 | portSIZE PERIPHERALS_SIZE; 152 | portADDRESS SYSTEM_BOOT_ADDRESS; 153 | portSIZE SYSTEM_BOOT_SIZE; 154 | }; 155 | typedef struct _PORT_SYSTEM_CONFIGURATION_TYPE PORT_SYSTEM_CONFIGURATION_TYPE; 156 | 157 | #endif 158 | -------------------------------------------------------------------------------- /Hardware/usb_bb.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file usb.c 3 | * 4 | * \brief This file contains the board specific code for enabling the use of 5 | * usb driver. 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 10 | */ 11 | /* 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 16 | * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * Neither the name of Texas Instruments Incorporated nor the names of 25 | * its contributors may be used to endorse or promote products derived 26 | * from this software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | 43 | #include "soc_AM335x.h" 44 | #include "hw_control_AM335x.h" 45 | #include "hw_usbOtg_AM335x.h" 46 | #include "hw_types.h" 47 | #include "beaglebone.h" 48 | #include "hw_cm_per.h" 49 | #include "hw_cm_wkup.h" 50 | 51 | /** 52 | * \brief This API returns a unique number which identifies itself 53 | * with the USB IP in AM335x SoC. 54 | * \param None 55 | * \return This returns a number '2' which is unique to USB IP in AM335x. 56 | */ 57 | unsigned int USBVersionGet(void) 58 | { 59 | return 2; 60 | } 61 | 62 | /** 63 | * \brief This function enables USB clocks 64 | * 65 | * \param None 66 | * 67 | * \return None. 68 | * 69 | */ 70 | void USB0ModuleClkConfig(void) 71 | { 72 | HWREG(SOC_CM_WKUP_REGS + CM_WKUP_CM_CLKDCOLDO_DPLL_PER) |= 73 | CM_WKUP_CM_CLKDCOLDO_DPLL_PER_DPLL_CLKDCOLDO_GATE_CTRL; 74 | 75 | 76 | HWREG(SOC_PRCM_REGS + CM_PER_USB0_CLKCTRL) |= 77 | CM_PER_USB0_CLKCTRL_MODULEMODE_ENABLE; 78 | 79 | while((HWREG(SOC_PRCM_REGS + CM_PER_USB0_CLKCTRL) & 80 | CM_PER_USB0_CLKCTRL_MODULEMODE) != CM_PER_USB0_CLKCTRL_MODULEMODE_ENABLE); 81 | 82 | 83 | /* 84 | ** Waiting for IDLEST field in CM_PER_USB0_CLKCTRL register to attain the 85 | ** desired value. 86 | */ 87 | while((CM_PER_USB0_CLKCTRL_IDLEST_FUNC << 88 | CM_PER_USB0_CLKCTRL_IDLEST_SHIFT)!= 89 | (HWREG(SOC_CM_PER_REGS + CM_PER_USB0_CLKCTRL) & 90 | CM_PER_USB0_CLKCTRL_IDLEST)); 91 | 92 | } 93 | 94 | /** 95 | * \brief This API enables the USB Interrupts through subsystem specific wrapper 96 | * registers 97 | * \param Base address 98 | * \return None 99 | */ 100 | void USBEnableInt(unsigned int ulBase) 101 | { 102 | HWREG(ulBase + USB_0_IRQ_ENABLE_SET_0) = 0xFFFFFFFF; 103 | HWREG(ulBase + USB_0_IRQ_ENABLE_SET_1) = 0xFFFFFFFF; 104 | #ifdef DMA_MODE 105 | HWREG(USBSS_BASE + USBSS_IRQ_ENABLE_SET) = 0xFFFFFFFF; 106 | #endif 107 | } 108 | 109 | /** 110 | * \brief This API Clear the USB Interrupts through subsystem specific wrapper 111 | * registers 112 | * \param Base address 113 | * \return None 114 | */ 115 | void USBClearInt(unsigned int ulBase) 116 | { 117 | 118 | } 119 | /** 120 | * \brief This API enables the USB Module clock 121 | * registers 122 | * \param Base address 123 | * \return None 124 | */ 125 | void USBModuleClkEnable(unsigned int ulIndex, unsigned int ulBase) 126 | { 127 | // 128 | //Call the clock enabel API 129 | // 130 | USB0ModuleClkConfig(); 131 | } 132 | 133 | /** 134 | * \brief This API Disables the module clock 135 | * registers 136 | * \param Base address 137 | * \return None 138 | */ 139 | void USBModuleClkDisable(unsigned int ulIndex, unsigned int ulBase) 140 | { 141 | // 142 | //Disables the module clock 143 | // 144 | HWREG(SOC_PRCM_REGS + CM_PER_USB0_CLKCTRL) |= 145 | CM_PER_USB0_CLKCTRL_MODULEMODE_DISABLE; 146 | } 147 | 148 | /****************************** End Of File *********************************/ 149 | -------------------------------------------------------------------------------- /Hardware/include/hw_cm_cefuse.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * @Component: CM 5 | * 6 | * @Filename: ../../CredDataBase/prcmCRED/cm_cefuse_cred.h 7 | * 8 | ============================================================================ */ 9 | /* 10 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 11 | */ 12 | /* 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 17 | * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * Neither the name of Texas Instruments Incorporated nor the names of 26 | * its contributors may be used to endorse or promote products derived 27 | * from this software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | */ 42 | 43 | 44 | 45 | #ifndef _HW_CM_CEFUSE_H_ 46 | #define _HW_CM_CEFUSE_H_ 47 | 48 | 49 | /***********************************************************************\ 50 | * Register arrays Definition 51 | \***********************************************************************/ 52 | 53 | 54 | /***********************************************************************\ 55 | * Bundle arrays Definition 56 | \***********************************************************************/ 57 | 58 | 59 | /***********************************************************************\ 60 | * Bundles Definition 61 | \***********************************************************************/ 62 | 63 | 64 | 65 | /*************************************************************************\ 66 | * Registers Definition 67 | \*************************************************************************/ 68 | 69 | #define CM_CEFUSE_CLKSTCTRL (0x0) 70 | #define CM_CEFUSE_CEFUSE_CLKCTRL (0x20) 71 | 72 | /**************************************************************************\ 73 | * Field Definition Macros 74 | \**************************************************************************/ 75 | 76 | /* CLKSTCTRL */ 77 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_CUST_EFUSE_SYS_CLK (0x00000200u) 78 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT (0x00000009u) 79 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_CUST_EFUSE_SYS_CLK_ACT (0x1u) 80 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_CUST_EFUSE_SYS_CLK_INACT (0x0u) 81 | 82 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_L4_CEFUSE_GICLK (0x00000100u) 83 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_L4_CEFUSE_GICLK_SHIFT (0x00000008u) 84 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_L4_CEFUSE_GICLK_ACT (0x1u) 85 | #define CM_CEFUSE_CLKSTCTRL_CLKACTIVITY_L4_CEFUSE_GICLK_INACT (0x0u) 86 | 87 | #define CM_CEFUSE_CLKSTCTRL_CLKTRCTRL (0x00000003u) 88 | #define CM_CEFUSE_CLKSTCTRL_CLKTRCTRL_SHIFT (0x00000000u) 89 | #define CM_CEFUSE_CLKSTCTRL_CLKTRCTRL_HW_AUTO (0x3u) 90 | #define CM_CEFUSE_CLKSTCTRL_CLKTRCTRL_NO_SLEEP (0x0u) 91 | #define CM_CEFUSE_CLKSTCTRL_CLKTRCTRL_SW_SLEEP (0x1u) 92 | #define CM_CEFUSE_CLKSTCTRL_CLKTRCTRL_SW_WKUP (0x2u) 93 | 94 | 95 | /* CEFUSE_CLKCTRL */ 96 | #define CM_CEFUSE_CEFUSE_CLKCTRL_IDLEST (0x00030000u) 97 | #define CM_CEFUSE_CEFUSE_CLKCTRL_IDLEST_SHIFT (0x00000010u) 98 | #define CM_CEFUSE_CEFUSE_CLKCTRL_IDLEST_DISABLE (0x3u) 99 | #define CM_CEFUSE_CEFUSE_CLKCTRL_IDLEST_FUNC (0x0u) 100 | #define CM_CEFUSE_CEFUSE_CLKCTRL_IDLEST_IDLE (0x2u) 101 | #define CM_CEFUSE_CEFUSE_CLKCTRL_IDLEST_TRANS (0x1u) 102 | 103 | #define CM_CEFUSE_CEFUSE_CLKCTRL_MODULEMODE (0x00000003u) 104 | #define CM_CEFUSE_CEFUSE_CLKCTRL_MODULEMODE_SHIFT (0x00000000u) 105 | #define CM_CEFUSE_CEFUSE_CLKCTRL_MODULEMODE_DISABLED (0x0u) 106 | #define CM_CEFUSE_CEFUSE_CLKCTRL_MODULEMODE_ENABLE (0x2u) 107 | #define CM_CEFUSE_CEFUSE_CLKCTRL_MODULEMODE_RESERVED (0x3u) 108 | #define CM_CEFUSE_CEFUSE_CLKCTRL_MODULEMODE_RESERVED_1 (0x1u) 109 | 110 | 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /Hardware/include/cmdline.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file cmdline.h 3 | * 4 | * \brief Prototypes for command line processing functions. 5 | */ 6 | /* 7 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 8 | */ 9 | /* 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * 17 | * Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the 20 | * distribution. 21 | * 22 | * Neither the name of Texas Instruments Incorporated nor the names of 23 | * its contributors may be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | */ 39 | 40 | #ifndef __CMDLINE_H__ 41 | #define __CMDLINE_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | #ifdef __cplusplus 50 | extern "C" 51 | { 52 | #endif 53 | 54 | //***************************************************************************** 55 | // 56 | //! \addtogroup cmdline_api 57 | //! @{ 58 | // 59 | //***************************************************************************** 60 | 61 | //***************************************************************************** 62 | // 63 | //! Defines the value that is returned if the command is not found. 64 | // 65 | //***************************************************************************** 66 | #define CMDLINE_BAD_CMD (-1) 67 | 68 | //***************************************************************************** 69 | // 70 | //! Defines the value that is returned if there are too many arguments. 71 | // 72 | //***************************************************************************** 73 | #define CMDLINE_TOO_MANY_ARGS (-2) 74 | 75 | //***************************************************************************** 76 | // 77 | // Command line function callback type. 78 | // 79 | //***************************************************************************** 80 | typedef int (*pfnCmdLine)(int argc, char *argv[]); 81 | 82 | //***************************************************************************** 83 | // 84 | //! Structure for an entry in the command list table. 85 | // 86 | //***************************************************************************** 87 | typedef struct 88 | { 89 | // 90 | //! A pointer to a string containing the name of the command. 91 | // 92 | const char *pcCmd; 93 | 94 | // 95 | //! A function pointer to the implementation of the command. 96 | // 97 | pfnCmdLine pfnCmd; 98 | 99 | // 100 | //! A pointer to a string of brief help text for the command. 101 | // 102 | const char *pcHelp; 103 | } 104 | tCmdLineEntry; 105 | 106 | //***************************************************************************** 107 | // 108 | //! This is the command table that must be provided by the application. 109 | // 110 | //***************************************************************************** 111 | extern tCmdLineEntry g_sCmdTable[]; 112 | 113 | //***************************************************************************** 114 | // 115 | // Close the Doxygen group. 116 | //! @} 117 | // 118 | //***************************************************************************** 119 | 120 | //***************************************************************************** 121 | // 122 | // Prototypes for the APIs. 123 | // 124 | //***************************************************************************** 125 | extern int CmdLineProcess(char *pcCmdLine); 126 | 127 | //***************************************************************************** 128 | // 129 | // Mark the end of the C bindings section for C++ compilers. 130 | // 131 | //***************************************************************************** 132 | #ifdef __cplusplus 133 | } 134 | #endif 135 | 136 | #endif // __CMDLINE_H__ 137 | --------------------------------------------------------------------------------