Example #1
0
// Declare Main application
void main(void) {
// Initialize variables
    vos_init_semaphore(&DevicesStarted, 0);
    vos_init_mutex(&dprintLock, VOS_MUTEX_UNLOCKED);
    Delay = 511;
    vos_init_semaphore(&EnumerationComplete, 0);
    vos_init_semaphore(&SendKeyboardReport, 0);

// Initialise RTOS
    vos_init(VOS_QUANTUM, VOS_TICK_INTERVAL, NUMBER_OF_DEVICES);

// Sets the CPU frequency of the connected device.
    vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);

// Initialise devices
    if (InitDevices()) {

// Initialise threads - pass a ThreadID to each thread
        vos_create_thread(28, SIZEOF_tcb, &Blink, 1, 1);
        vos_create_thread(27, SIZEOF_tcb, &EnumerateSlave, 1, 2);
        vos_create_thread(26, SIZEOF_tcb, &FindKeyboard, 1, 4);
        vos_create_thread(25, SIZEOF_tcb, &SendReports, 1, 8);
        vos_create_thread( 1, SIZEOF_tcb, &MyIdleTask, 0);

// Start Scheduler to kick off the created thread(s)
        vos_start_scheduler();
        }

// It is an error to get here, use a breakpoint to catch this
    while (1) {
        CheckStatus(1, ErrorSchedulerDidNotStart);
        }
    }
Example #2
0
// Declare Main application
void main(void) {
// Initialize variables
    vos_init_semaphore(&DevicesStarted, 0);

// Initialise RTOS
    vos_init(VOS_QUANTUM, VOS_TICK_INTERVAL, NUMBER_OF_DEVICES);

// Sets the CPU frequency of the connected device.
    vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);

// Initialise devices
    if (InitDevices()) {

// Initialise thread(s)
        vos_create_thread(27, SIZEOF_tcb, &HelloWorld, 0);
        vos_create_thread(28, SIZEOF_tcb, &Blink, 0);

// Start Scheduler to kick off the created thread(s)
        vos_start_scheduler();
        }

// It is an error to get here, use a breakpoint to catch this
    while (1) {
        CheckStatus(FALSE, ErrorSchedulerDidNotStart);
        }
    }
void main(void)
{
  vos_init(50, VOS_TICK_INTERVAL, 0);
  vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);
  vos_set_idle_thread_tcb_size(512);

  tcbFIRMWARE = vos_create_thread_ex(20, 4096, firmware, "Application", 0);

  vos_start_scheduler();

main_loop:
  goto main_loop;
}
Example #4
0
/* Main code - entry point to firmware */
void main(void)
{
	/* FTDI:SDD Driver Declarations */
	// UART Driver configuration context
	uart_context_t uartContext;
	// GPIO Port A configuration context
	gpio_context_t gpioContextA;
	// USB Host configuration context
	usbhost_context_t usbhostContext;
	/* FTDI:EDD */

	/* FTDI:SKI Kernel Initialisation */
	vos_init(50, VOS_TICK_INTERVAL, VOS_NUMBER_DEVICES);
	vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);
	vos_set_idle_thread_tcb_size(512);
	/* FTDI:EKI */

	iomux_setup();

	/* FTDI:SDI Driver Initialisation */
	// Initialise UART
	uartContext.buffer_size = VOS_BUFFER_SIZE_128_BYTES;
	uart_init(VOS_DEV_UART,&uartContext);
	
	// Initialise GPIO A
	gpioContextA.port_identifier = GPIO_PORT_A;
	gpio_init(VOS_DEV_GPIO_PORT_A,&gpioContextA);
	
	// Initialise USB HID Device
	usbHostHID_init(VOS_DEV_USBHOST_HID);
	
	// Initialise USB Host
	usbhostContext.if_count = 8;
	usbhostContext.ep_count = 16;
	usbhostContext.xfer_count = 2;
	usbhostContext.iso_xfer_count = 2;
	usbhost_init(-1, VOS_DEV_USBHOST_2, &usbhostContext);
	/* FTDI:EDI */

	/* FTDI:SCT Thread Creation */
	tcbFIRMWARE = vos_create_thread_ex(20, 4096, firmware, "Application", 0);
	/* FTDI:ECT */
	
	vos_start_scheduler();

main_loop:
	goto main_loop;
}
Example #5
0
/* Main code - entry point to firmware */
void main(void)
{
	/* FTDI:SDD Driver Declarations */
	// UART Driver configuration context
	uart_context_t uartContext;
	/* FTDI:EDD */
	/*Driver Declarations */
	//usbSlaveFt232_init_t ft232Context;
	/* FTDI:SKI Kernel Initialisation */
	vos_init(50, VOS_TICK_INTERVAL, VOS_NUMBER_DEVICES);
	vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);
	vos_set_idle_thread_tcb_size(512);
	/* FTDI:EKI */

	iomux_setup();
	
	global_array_init();
	/* FTDI:SDI Driver Initialisation */
	// Initialise USB Slave Port 0
	usbslave_init(0, VOS_DEV_USBSLAVE_1);
	
	// Initialise USB Slave Port 1
	usbslave_init(1, VOS_DEV_USBSLAVE_2);
	
	// Initialise UART
	uartContext.buffer_size = VOS_BUFFER_SIZE_128_BYTES;
	uart_init(VOS_DEV_UART,&uartContext);
	/* FTDI:EDI */
	
	USBTMC_function_init(VOS_DEV_USBSLAVE_USBTMC);
	USBBRI_function_init(VOS_DEV_USBSLAVE_USBBRI);
	
	/* FTDI:SCT Thread Creation */
	tcbFIRMWARE = vos_create_thread_ex(20, 4096, firmware, "Application", 0);
	/* FTDI:ECT */

	vos_start_scheduler();

main_loop:
	goto main_loop;
}
Example #6
0
/* Main code - entry point to firmware */
void main(void)
{
	/* FTDI:SDD Driver Declarations */
	// UART Driver configuration context
	uart_context_t uartContext;
	// SPI Master configuration context
	spimaster_context_t spimContext;
	// GPIO Port A configuration context
	gpio_context_t gpioContextA;
	// GPIO Port B configuration context
	gpio_context_t gpioContextB;
	// USB Host configuration context
	usbhost_context_t usbhostContext;
	/* FTDI:EDD */

	/* FTDI:SKI Kernel Initialisation */
	vos_init(50, VOS_TICK_INTERVAL, VOS_NUMBER_DEVICES);
	vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);
	vos_set_idle_thread_tcb_size(512);
	/* FTDI:EKI */

	iomux_setup();
	
	/* FTDI:SDI Driver Initialisation */
	// Initialise UART
	uartContext.buffer_size = VOS_BUFFER_SIZE_128_BYTES;
	uart_init(VOS_DEV_UART,&uartContext);
	
	// Initialise SPI Master
	spimContext.buffer_size = VOS_BUFFER_SIZE_128_BYTES;
	spimaster_init(VOS_DEV_SPI_MASTER,&spimContext);
	
	// Initialise GPIO A
	gpioContextA.port_identifier = GPIO_PORT_A;
	gpio_init(VOS_DEV_GPIO_PORT_A,&gpioContextA);
	
	// Initialise GPIO B
	gpioContextB.port_identifier = GPIO_PORT_B;
	gpio_init(VOS_DEV_GPIO_PORT_B,&gpioContextB);
	
	// Initialise FAT File System Driver
	fatdrv_init(VOS_DEV_FAT_FILE_SYSTEM);
	
	// Initialise BOMS Device Driver
	boms_init(VOS_DEV_BOMS);
	
	// Initialise USB HID Device
	usbHostHID_init(VOS_DEV_USBHOST_HID_1);
	
	// Initialise USB HID Device
	usbHostHID_init(VOS_DEV_USBHOST_HID_2);
	
	
	
	
	
	// Initialise USB Host
	usbhostContext.if_count = 8;
	usbhostContext.ep_count = 16;
	usbhostContext.xfer_count = 2;
	usbhostContext.iso_xfer_count = 2;
	if(usbhost_init(VOS_DEV_USBHOST_1, VOS_DEV_USBHOST_2, &usbhostContext) != 0)
		while(1);	//FAILED
	/* FTDI:EDI */

	/* FTDI:SCT Thread Creation */
	tcbFIRMWARE = vos_create_thread_ex(31, 2048, firmware, "Application", 0);
	/* FTDI:ECT */

	vos_delay_msecs(100);
	vos_start_scheduler();

main_loop:
	vos_delay_msecs(100);
	goto main_loop;
}
Example #7
0
//////////////////////////////////////////////////////////////////////
//
// MAIN
//
//////////////////////////////////////////////////////////////////////
void main(void)
{
	usbhost_context_t usbhostContext;
	gpio_context_t gpioCtx;
	spislave_context_t spiSlaveContext;

	// Kernel initialisation
	vos_init(50, VOS_TICK_INTERVAL, VOS_NUMBER_DEVICES);
	vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);
	vos_set_idle_thread_tcb_size(512);

	// Set up the io multiplexing
	iomux_setup();

	spiSlaveContext.slavenumber = SPI_SLAVE_0;
	spiSlaveContext.buffer_size = 64;
	spislave_init(VOS_DEV_SPISLAVE, &spiSlaveContext);
	
	// Initialise GPIO port A
	gpioCtx.port_identifier = GPIO_PORT_A;
	gpio_init(VOS_DEV_GPIO_A,&gpioCtx); 
	
	// Initialise USB Host devices
	usbhostContext.if_count = 8;
	usbhostContext.ep_count = 16;
	usbhostContext.xfer_count = 2;
	usbhostContext.iso_xfer_count = 2;
	usbhost_init(VOS_DEV_USBHOST_1, VOS_DEV_USBHOST_2, &usbhostContext);
	

	// Initialise the USB function device
	usbhostGeneric_init(VOS_DEV_USBHOSTGENERIC_1);
	usbhostGeneric_init(VOS_DEV_USBHOSTGENERIC_2);

	PortA.uchActivityLed = LED_USB_A;
	PortA.uchMsg = MSG_PORTA;
	PortA.uchDeviceNumberBase = VOS_DEV_USBHOST_1;
	PortA.uchDeviceNumber = VOS_DEV_USBHOSTGENERIC_1;
	
	PortB.uchActivityLed = LED_USB_B;
	PortB.uchMsg = MSG_PORTB;
	PortB.uchDeviceNumberBase = VOS_DEV_USBHOST_2;
	PortB.uchDeviceNumber = VOS_DEV_USBHOSTGENERIC_2;
	

	vos_init_semaphore(&setupSem,0);
	fifo_init(&stSPIReadFIFO);
	fifo_init(&stSPIWriteFIFO);
	
	
	tcbSetup = vos_create_thread_ex(10, 1024, Setup, "Setup", 0);
	tcbHostA = vos_create_thread_ex(20, 1024, RunHostPort, "RunHostPortA", sizeof(HOST_PORT_DATA*), &PortA);
	//tcbHostB = vos_create_thread_ex(21, 1024, RunHostPort, "RunHostPortB", sizeof(HOST_PORT_DATA*), &PortB);
	tcbRunSPISend = vos_create_thread_ex(20, 1024, RunSPISend, "RunSPISend", 0);
	tcbRunSPIReceive = vos_create_thread_ex(19, 1024, RunSPIReceive, "RunSPIReceive", 0);	
	tcbRunUSBSend = vos_create_thread_ex(20, 1024, RunUSBSend, "RunUSBSend", 0);

	
	// And start the thread
	vos_start_scheduler();

main_loop:
	goto main_loop;
}
Example #8
0
//////////////////////////////////////////////////////////////////////
//
// MAIN
//
//////////////////////////////////////////////////////////////////////
void main(void)
{
	/* FTDI:SDD Driver Declarations */
	// UART Driver configuration context
	uart_context_t uartContext;
	// USB Host configuration context
	usbhost_context_t usbhostContext;
	gpio_context_t gpioCtx;

	// Kernel initialisation
	vos_init(50, VOS_TICK_INTERVAL, VOS_NUMBER_DEVICES);
	vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);
	vos_set_idle_thread_tcb_size(512);

	// Set up the io multiplexing
	iomux_setup();

	// Initialise GPIO port A
	gpioCtx.port_identifier = GPIO_PORT_A;
	gpio_init(VOS_DEV_GPIO_A,&gpioCtx); //

	// Initialise UART
	uartContext.buffer_size = VOS_BUFFER_SIZE_128_BYTES;
	uart_init(VOS_DEV_UART, &uartContext);
	

	// Initialise USB Host devices
	usbhostContext.if_count = 8;
	usbhostContext.ep_count = 16;
	usbhostContext.xfer_count = 2;
	usbhostContext.iso_xfer_count = 2;
	//usbhost_init(VOS_DEV_USBHOST_1, VOS_DEV_USBHOST_2, &usbhostContext);
	usbhost_init(VOS_DEV_USBHOST_1, -1, &usbhostContext);

	// Initialise the USB function device
	usbhostGeneric_init(VOS_DEV_USBHOSTGENERIC_1);
	//usbhostGeneric_init(VOS_DEV_USBHOSTGENERIC_2);


	PortA.uchDeviceNumber = VOS_DEV_USBHOSTGENERIC_1;
	PortA.uchMidiChannel = 0;
	PortA.uchActivityLed = 0b00000010;

	//PortB.uchDeviceNumber = VOS_DEV_USBHOSTGENERIC_2;
	//PortB.uchMidiChannel = 1;
	//PortB.uchActivityLed = 0b00000100;

	// setup the event queue
	SMQInit();

	// Initializes our device with the device manager.
	
	tcbSetup = vos_create_thread_ex(10, 1024, Setup, "Setup", 0);
	tcbHostA = vos_create_thread_ex(20, 1024, RunHostPort, "RunHostPortA", sizeof(HOST_PORT_DATA*), &PortA);
	//tcbHostB = vos_create_thread_ex(20, 1024, RunHostPort, "RunHostPortB", sizeof(HOST_PORT_DATA*), &PortB);
	tcbPlaypad = vos_create_thread_ex(15, 1024, RunPlaypad, "RunPlaypad", 0);
	tcbMetro = vos_create_thread_ex(15, 1024, RunMetronome, "RunMetronome", 0);
	tcbMIDIInput = vos_create_thread_ex(15, 1024, RunMIDIInput, "RunMIDIInput", 0);

	vos_init_semaphore(&setupSem,0);
	
	// And start the thread
	vos_start_scheduler();

main_loop:
	goto main_loop;
}