The Main Program - XMOS xCORE-200 Multi-channel Audio board Design Manual

Usb audio
Hide thumbs Also See for xCORE-200 Multi-channel Audio board:
Table of Contents

Advertisement

USB Audio Design Guide
# include < xs1 .h >
# include " port32A . h "
/* Functions that handle functions that must occur on stream
* start / stop e . g . DAC mute / un - mute . These need implementing
* for a specific design .
*
* I mp l em en t at io n s for the L1 USB Audio Reference Design
*/
/* Any actions required for stream start e . g . DAC un - mute - run every
* stream start .
*
* For L1 USB Audio Reference Design we illuminate LED B ( connected
* to port 32 A )
*
* Since this port is shared with other functionality inline assembly
* is used to access the port resource .
*/
void U s e r A u d i o S t r e a m S t a r t ( void )
{
}
/* Any actions required on stream stop e . g . DAC mute - run every
* stream stop
* For L1 USB Audio Reference Design we extinguish LED B ( connected
* to port 32 A )
*/
void U s e r A u d i o S t r e a m S t o p ( void )
{
}

5.6.3 The main program

The main() function is shared across all applications is therefore part of the
framework. It is located in sc_usb_audio and contains:
A declaration of all the ports used in the framework. These vary depending on
the PCB an application is running on.
A main function which declares some channels and then has a par statement
which runs the required cores in parallel.
XM0088546.1
int x ;
/* Peek at current port value using port 32 A resource ID */
asm ( " peek %0 , res [%1] " : " = r " ( x ) : " r " ( XS1_PORT_32A ) ) ;
x |= P32A_LED_B ;
/* Output to port */
asm ( " out res [%0] , %1 " :: " r " ( XS1_PORT_32A ) ," r " ( x ) ) ;
int x ;
asm ( " peek %0 , res [%1] " : " = r " ( x ) : " r " ( XS1_PORT_32A ) ) ;
x &= (~ P32A_LED_B ) ;
asm ( " out res [%0] , %1 " :: " r " ( XS1_PORT_32A ) ," r " ( x ) ) ;
57/110

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents