add lib_dnr lib_roleswitch
This commit is contained in:
15
lib_roleswitch/lib_roleswitch/README.txt
Normal file
15
lib_roleswitch/lib_roleswitch/README.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
module_roleswitch
|
||||
*****************
|
||||
|
||||
scope:
|
||||
General Use
|
||||
|
||||
description:
|
||||
Roleswitch helper functions
|
||||
|
||||
keywords:
|
||||
Apple, USB, roleswitch, MFI
|
||||
|
||||
boards:
|
||||
XK-USB-AUDIO-U8-2C
|
||||
11
lib_roleswitch/lib_roleswitch/include/roleswitchflag.h
Normal file
11
lib_roleswitch/lib_roleswitch/include/roleswitchflag.h
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#define USB_IN_FLAG 0x11AA
|
||||
#define COAX_IN_FLAG 0x22BB
|
||||
#define OPT_IN_FLAG 0x33CC
|
||||
#define UAC1_IN_FLAG 0x44DD
|
||||
#define BT_IN_FLAG 0x55EE
|
||||
#define I2S_IN_FLAG 0x66FF
|
||||
|
||||
|
||||
void SetRoleSwitchFlag(unsigned flagVal);
|
||||
unsigned GetRoleSwitchFlag();
|
||||
6
lib_roleswitch/lib_roleswitch/lib_build_info.cmake
Normal file
6
lib_roleswitch/lib_roleswitch/lib_build_info.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
set(LIB_NAME lib_roleswitch)
|
||||
set(LIB_VERSION 0.0.1)
|
||||
set(LIB_INCLUDES include)
|
||||
set(LIB_COMPILER_FLAGS -Os)
|
||||
|
||||
XMOS_REGISTER_MODULE()
|
||||
22
lib_roleswitch/lib_roleswitch/src/roleswitchflag.xc
Normal file
22
lib_roleswitch/lib_roleswitch/src/roleswitchflag.xc
Normal file
@@ -0,0 +1,22 @@
|
||||
#if defined(__XS2A__)
|
||||
/* Note range 0x7FFC8 - 0x7FFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0x7ffc8
|
||||
#else
|
||||
/* Note range 0xFFFC8 - 0xFFFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0xfffc8
|
||||
#endif
|
||||
|
||||
|
||||
/* Store Flag to fixed address */
|
||||
void SetRoleSwitchFlag(unsigned x)
|
||||
{
|
||||
asm volatile("stw %0, %1[0]" :: "r"(x), "r"(FLAG_ADDRESS));
|
||||
}
|
||||
|
||||
/* Load flag from fixed address */
|
||||
unsigned GetRoleSwitchFlag()
|
||||
{
|
||||
unsigned x;
|
||||
asm volatile("ldw %0, %1[0]" : "=r"(x) : "r"(FLAG_ADDRESS));
|
||||
return x;
|
||||
}
|
||||
Reference in New Issue
Block a user