usb talking
parent
a6936e53e7
commit
3e291c1791
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef _ARC_H_
|
||||||
|
#define _ARC_H_
|
||||||
|
|
||||||
|
#include "atmel_start.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -0,0 +1,244 @@
|
|||||||
|
util/serial.d util/serial.o: ../util/serial.c ../util/serial.h \
|
||||||
|
/usr/arm-none-eabi/include/stdio.h /usr/arm-none-eabi/include/_ansi.h \
|
||||||
|
/usr/arm-none-eabi/include/newlib.h \
|
||||||
|
/usr/arm-none-eabi/include/_newlib_version.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/config.h \
|
||||||
|
/usr/arm-none-eabi/include/machine/ieeefp.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/features.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/cdefs.h \
|
||||||
|
/usr/arm-none-eabi/include/machine/_default_types.h \
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stddef.h \
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stdarg.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/reent.h \
|
||||||
|
/usr/arm-none-eabi/include/_ansi.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_types.h \
|
||||||
|
/usr/arm-none-eabi/include/machine/_types.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/lock.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/types.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_stdint.h \
|
||||||
|
/usr/arm-none-eabi/include/machine/endian.h \
|
||||||
|
/usr/arm-none-eabi/include/machine/_endian.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/select.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_sigset.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_timeval.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/timespec.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_timespec.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_pthreadtypes.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/sched.h \
|
||||||
|
/usr/arm-none-eabi/include/machine/types.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/stdio.h \
|
||||||
|
/usr/arm-none-eabi/include/stdlib.h \
|
||||||
|
/usr/arm-none-eabi/include/machine/stdlib.h \
|
||||||
|
/usr/arm-none-eabi/include/alloca.h /usr/arm-none-eabi/include/string.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_locale.h \
|
||||||
|
/usr/arm-none-eabi/include/strings.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/string.h ../usb_start.h \
|
||||||
|
../usb/class/cdc/device/cdcdf_acm.h ../usb/device/usbdc.h \
|
||||||
|
../usb/usb_includes.h \
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stdbool.h \
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stdint.h \
|
||||||
|
/usr/arm-none-eabi/include/stdint.h \
|
||||||
|
/usr/arm-none-eabi/include/sys/_intsup.h ../hal/utils/include/utils.h \
|
||||||
|
../hal/utils/include/utils_list.h ../hal/utils/include/compiler.h \
|
||||||
|
../hal/utils/include/parts.h ../samd21a/include/samd21.h \
|
||||||
|
../samd21a/include/samd21e18a.h ../CMSIS/Core/Include/core_cm0plus.h \
|
||||||
|
../CMSIS/Core/Include/cmsis_version.h \
|
||||||
|
../CMSIS/Core/Include/cmsis_compiler.h ../CMSIS/Core/Include/cmsis_gcc.h \
|
||||||
|
../samd21a/include/system_samd21.h ../samd21a/include/component/ac.h \
|
||||||
|
../samd21a/include/component/adc.h ../samd21a/include/component/dac.h \
|
||||||
|
../samd21a/include/component/dmac.h ../samd21a/include/component/dsu.h \
|
||||||
|
../samd21a/include/component/eic.h ../samd21a/include/component/evsys.h \
|
||||||
|
../samd21a/include/component/gclk.h \
|
||||||
|
../samd21a/include/component/hmatrixb.h \
|
||||||
|
../samd21a/include/component/i2s.h ../samd21a/include/component/mtb.h \
|
||||||
|
../samd21a/include/component/nvmctrl.h \
|
||||||
|
../samd21a/include/component/pac.h ../samd21a/include/component/pm.h \
|
||||||
|
../samd21a/include/component/port.h ../samd21a/include/component/rtc.h \
|
||||||
|
../samd21a/include/component/sercom.h \
|
||||||
|
../samd21a/include/component/sysctrl.h ../samd21a/include/component/tc.h \
|
||||||
|
../samd21a/include/component/tcc.h ../samd21a/include/component/usb.h \
|
||||||
|
../samd21a/include/component/wdt.h ../samd21a/include/instance/ac.h \
|
||||||
|
../samd21a/include/instance/adc.h ../samd21a/include/instance/dac.h \
|
||||||
|
../samd21a/include/instance/dmac.h ../samd21a/include/instance/dsu.h \
|
||||||
|
../samd21a/include/instance/eic.h ../samd21a/include/instance/evsys.h \
|
||||||
|
../samd21a/include/instance/gclk.h \
|
||||||
|
../samd21a/include/instance/sbmatrix.h ../samd21a/include/instance/i2s.h \
|
||||||
|
../samd21a/include/instance/mtb.h ../samd21a/include/instance/nvmctrl.h \
|
||||||
|
../samd21a/include/instance/pac0.h ../samd21a/include/instance/pac1.h \
|
||||||
|
../samd21a/include/instance/pac2.h ../samd21a/include/instance/pm.h \
|
||||||
|
../samd21a/include/instance/port.h ../samd21a/include/instance/ptc.h \
|
||||||
|
../samd21a/include/instance/rtc.h ../samd21a/include/instance/sercom0.h \
|
||||||
|
../samd21a/include/instance/sercom1.h \
|
||||||
|
../samd21a/include/instance/sercom2.h \
|
||||||
|
../samd21a/include/instance/sercom3.h \
|
||||||
|
../samd21a/include/instance/sysctrl.h ../samd21a/include/instance/tc3.h \
|
||||||
|
../samd21a/include/instance/tc4.h ../samd21a/include/instance/tc5.h \
|
||||||
|
../samd21a/include/instance/tcc0.h ../samd21a/include/instance/tcc1.h \
|
||||||
|
../samd21a/include/instance/tcc2.h ../samd21a/include/instance/usb.h \
|
||||||
|
../samd21a/include/instance/wdt.h ../samd21a/include/pio/samd21e18a.h \
|
||||||
|
../hri/hri_d21.h ../samd21a/include/sam.h ../hri/hri_ac_d21.h \
|
||||||
|
../hal/include/hal_atomic.h ../hri/hri_adc_d21.h ../hri/hri_dac_d21.h \
|
||||||
|
../hri/hri_dmac_d21.h ../hri/hri_dsu_d21.h ../hri/hri_eic_d21.h \
|
||||||
|
../hri/hri_evsys_d21.h ../hri/hri_gclk_d21.h ../hri/hri_hmatrixb_d21.h \
|
||||||
|
../hri/hri_i2s_d21.h ../hri/hri_mtb_d21.h ../hri/hri_nvic_d21.h \
|
||||||
|
../hri/hri_nvmctrl_d21.h ../hri/hri_pac_d21.h ../hri/hri_pm_d21.h \
|
||||||
|
../hri/hri_port_d21.h ../hri/hri_rtc_d21.h ../hri/hri_sercom_d21.h \
|
||||||
|
../hri/hri_sysctrl_d21.h ../hri/hri_systemcontrol_d21.h \
|
||||||
|
../hri/hri_systick_d21.h ../hri/hri_tc_d21.h ../hri/hri_tcc_d21.h \
|
||||||
|
../hri/hri_usb_d21.h ../hri/hri_wdt_d21.h \
|
||||||
|
../hal/utils/include/err_codes.h ../hal/utils/include/utils_assert.h \
|
||||||
|
../usb/usb_protocol.h ../usb/usb_includes.h \
|
||||||
|
../hal/include/hal_usb_device.h ../hal/include/hpl_usb_device.h \
|
||||||
|
../hal/include/hpl_usb.h ../config/hpl_usb_config.h \
|
||||||
|
../config/usbd_config.h ../usb/class/cdc/usb_protocol_cdc.h \
|
||||||
|
../usb/class/cdc/device/cdcdf_acm_desc.h
|
||||||
|
../util/serial.h:
|
||||||
|
/usr/arm-none-eabi/include/stdio.h:
|
||||||
|
/usr/arm-none-eabi/include/_ansi.h:
|
||||||
|
/usr/arm-none-eabi/include/newlib.h:
|
||||||
|
/usr/arm-none-eabi/include/_newlib_version.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/config.h:
|
||||||
|
/usr/arm-none-eabi/include/machine/ieeefp.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/features.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/cdefs.h:
|
||||||
|
/usr/arm-none-eabi/include/machine/_default_types.h:
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stddef.h:
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stdarg.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/reent.h:
|
||||||
|
/usr/arm-none-eabi/include/_ansi.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_types.h:
|
||||||
|
/usr/arm-none-eabi/include/machine/_types.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/lock.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/types.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_stdint.h:
|
||||||
|
/usr/arm-none-eabi/include/machine/endian.h:
|
||||||
|
/usr/arm-none-eabi/include/machine/_endian.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/select.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_sigset.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_timeval.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/timespec.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_timespec.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_pthreadtypes.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/sched.h:
|
||||||
|
/usr/arm-none-eabi/include/machine/types.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/stdio.h:
|
||||||
|
/usr/arm-none-eabi/include/stdlib.h:
|
||||||
|
/usr/arm-none-eabi/include/machine/stdlib.h:
|
||||||
|
/usr/arm-none-eabi/include/alloca.h:
|
||||||
|
/usr/arm-none-eabi/include/string.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_locale.h:
|
||||||
|
/usr/arm-none-eabi/include/strings.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/string.h:
|
||||||
|
../usb_start.h:
|
||||||
|
../usb/class/cdc/device/cdcdf_acm.h:
|
||||||
|
../usb/device/usbdc.h:
|
||||||
|
../usb/usb_includes.h:
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stdbool.h:
|
||||||
|
/usr/lib/gcc/arm-none-eabi/10.2.0/include/stdint.h:
|
||||||
|
/usr/arm-none-eabi/include/stdint.h:
|
||||||
|
/usr/arm-none-eabi/include/sys/_intsup.h:
|
||||||
|
../hal/utils/include/utils.h:
|
||||||
|
../hal/utils/include/utils_list.h:
|
||||||
|
../hal/utils/include/compiler.h:
|
||||||
|
../hal/utils/include/parts.h:
|
||||||
|
../samd21a/include/samd21.h:
|
||||||
|
../samd21a/include/samd21e18a.h:
|
||||||
|
../CMSIS/Core/Include/core_cm0plus.h:
|
||||||
|
../CMSIS/Core/Include/cmsis_version.h:
|
||||||
|
../CMSIS/Core/Include/cmsis_compiler.h:
|
||||||
|
../CMSIS/Core/Include/cmsis_gcc.h:
|
||||||
|
../samd21a/include/system_samd21.h:
|
||||||
|
../samd21a/include/component/ac.h:
|
||||||
|
../samd21a/include/component/adc.h:
|
||||||
|
../samd21a/include/component/dac.h:
|
||||||
|
../samd21a/include/component/dmac.h:
|
||||||
|
../samd21a/include/component/dsu.h:
|
||||||
|
../samd21a/include/component/eic.h:
|
||||||
|
../samd21a/include/component/evsys.h:
|
||||||
|
../samd21a/include/component/gclk.h:
|
||||||
|
../samd21a/include/component/hmatrixb.h:
|
||||||
|
../samd21a/include/component/i2s.h:
|
||||||
|
../samd21a/include/component/mtb.h:
|
||||||
|
../samd21a/include/component/nvmctrl.h:
|
||||||
|
../samd21a/include/component/pac.h:
|
||||||
|
../samd21a/include/component/pm.h:
|
||||||
|
../samd21a/include/component/port.h:
|
||||||
|
../samd21a/include/component/rtc.h:
|
||||||
|
../samd21a/include/component/sercom.h:
|
||||||
|
../samd21a/include/component/sysctrl.h:
|
||||||
|
../samd21a/include/component/tc.h:
|
||||||
|
../samd21a/include/component/tcc.h:
|
||||||
|
../samd21a/include/component/usb.h:
|
||||||
|
../samd21a/include/component/wdt.h:
|
||||||
|
../samd21a/include/instance/ac.h:
|
||||||
|
../samd21a/include/instance/adc.h:
|
||||||
|
../samd21a/include/instance/dac.h:
|
||||||
|
../samd21a/include/instance/dmac.h:
|
||||||
|
../samd21a/include/instance/dsu.h:
|
||||||
|
../samd21a/include/instance/eic.h:
|
||||||
|
../samd21a/include/instance/evsys.h:
|
||||||
|
../samd21a/include/instance/gclk.h:
|
||||||
|
../samd21a/include/instance/sbmatrix.h:
|
||||||
|
../samd21a/include/instance/i2s.h:
|
||||||
|
../samd21a/include/instance/mtb.h:
|
||||||
|
../samd21a/include/instance/nvmctrl.h:
|
||||||
|
../samd21a/include/instance/pac0.h:
|
||||||
|
../samd21a/include/instance/pac1.h:
|
||||||
|
../samd21a/include/instance/pac2.h:
|
||||||
|
../samd21a/include/instance/pm.h:
|
||||||
|
../samd21a/include/instance/port.h:
|
||||||
|
../samd21a/include/instance/ptc.h:
|
||||||
|
../samd21a/include/instance/rtc.h:
|
||||||
|
../samd21a/include/instance/sercom0.h:
|
||||||
|
../samd21a/include/instance/sercom1.h:
|
||||||
|
../samd21a/include/instance/sercom2.h:
|
||||||
|
../samd21a/include/instance/sercom3.h:
|
||||||
|
../samd21a/include/instance/sysctrl.h:
|
||||||
|
../samd21a/include/instance/tc3.h:
|
||||||
|
../samd21a/include/instance/tc4.h:
|
||||||
|
../samd21a/include/instance/tc5.h:
|
||||||
|
../samd21a/include/instance/tcc0.h:
|
||||||
|
../samd21a/include/instance/tcc1.h:
|
||||||
|
../samd21a/include/instance/tcc2.h:
|
||||||
|
../samd21a/include/instance/usb.h:
|
||||||
|
../samd21a/include/instance/wdt.h:
|
||||||
|
../samd21a/include/pio/samd21e18a.h:
|
||||||
|
../hri/hri_d21.h:
|
||||||
|
../samd21a/include/sam.h:
|
||||||
|
../hri/hri_ac_d21.h:
|
||||||
|
../hal/include/hal_atomic.h:
|
||||||
|
../hri/hri_adc_d21.h:
|
||||||
|
../hri/hri_dac_d21.h:
|
||||||
|
../hri/hri_dmac_d21.h:
|
||||||
|
../hri/hri_dsu_d21.h:
|
||||||
|
../hri/hri_eic_d21.h:
|
||||||
|
../hri/hri_evsys_d21.h:
|
||||||
|
../hri/hri_gclk_d21.h:
|
||||||
|
../hri/hri_hmatrixb_d21.h:
|
||||||
|
../hri/hri_i2s_d21.h:
|
||||||
|
../hri/hri_mtb_d21.h:
|
||||||
|
../hri/hri_nvic_d21.h:
|
||||||
|
../hri/hri_nvmctrl_d21.h:
|
||||||
|
../hri/hri_pac_d21.h:
|
||||||
|
../hri/hri_pm_d21.h:
|
||||||
|
../hri/hri_port_d21.h:
|
||||||
|
../hri/hri_rtc_d21.h:
|
||||||
|
../hri/hri_sercom_d21.h:
|
||||||
|
../hri/hri_sysctrl_d21.h:
|
||||||
|
../hri/hri_systemcontrol_d21.h:
|
||||||
|
../hri/hri_systick_d21.h:
|
||||||
|
../hri/hri_tc_d21.h:
|
||||||
|
../hri/hri_tcc_d21.h:
|
||||||
|
../hri/hri_usb_d21.h:
|
||||||
|
../hri/hri_wdt_d21.h:
|
||||||
|
../hal/utils/include/err_codes.h:
|
||||||
|
../hal/utils/include/utils_assert.h:
|
||||||
|
../usb/usb_protocol.h:
|
||||||
|
../usb/usb_includes.h:
|
||||||
|
../hal/include/hal_usb_device.h:
|
||||||
|
../hal/include/hpl_usb_device.h:
|
||||||
|
../hal/include/hpl_usb.h:
|
||||||
|
../config/hpl_usb_config.h:
|
||||||
|
../config/usbd_config.h:
|
||||||
|
../usb/class/cdc/usb_protocol_cdc.h:
|
||||||
|
../usb/class/cdc/device/cdcdf_acm_desc.h:
|
Binary file not shown.
@ -0,0 +1,42 @@
|
|||||||
|
#include "serial.h"
|
||||||
|
#include "usb_start.h"
|
||||||
|
|
||||||
|
#define MAX_PRINTF_BUFFER (64)
|
||||||
|
|
||||||
|
static uint8_t printf_buffer[MAX_PRINTF_BUFFER];
|
||||||
|
static volatile bool b_usb_ready = false;
|
||||||
|
|
||||||
|
static bool usb_cb_state_c(usb_cdc_control_signal_t state)
|
||||||
|
{
|
||||||
|
if(state.rs232.DTR == 1)
|
||||||
|
{
|
||||||
|
b_usb_ready = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b_usb_ready = false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void arc_serial_init()
|
||||||
|
{
|
||||||
|
memset(printf_buffer, '\0', MAX_PRINTF_BUFFER);
|
||||||
|
usb_init();
|
||||||
|
while(!cdcdf_acm_is_enabled()){}
|
||||||
|
cdcdf_acm_register_callback(CDCDF_ACM_CB_STATE_C, (FUNC_PTR)usb_cb_state_c);
|
||||||
|
while(!b_usb_ready);
|
||||||
|
delay_ms(2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t arc_printf(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
while(!b_usb_ready){}
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsprintf(printf_buffer, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
volatile int32_t ret = cdcdf_acm_write(printf_buffer, (uint32_t)(strlen((const char*)printf_buffer)));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
#include "serial.h"
|
||||||
|
#include "usb_start.h"
|
||||||
|
|
||||||
|
#define MAX_PRINTF_BUFFER (64)
|
||||||
|
|
||||||
|
static uint32_t printf_buffer[MAX_PRINTF_BUFFER / 4];
|
||||||
|
static volatile bool b_usb_ready = false;
|
||||||
|
|
||||||
|
static bool usb_cb_state_c(usb_cdc_control_signal_t state)
|
||||||
|
{
|
||||||
|
if(state.rs232.DTR)
|
||||||
|
{
|
||||||
|
b_usb_ready = true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void arc_serial_init()
|
||||||
|
{
|
||||||
|
memset(printf_buffer, '\0', MAX_PRINTF_BUFFER);
|
||||||
|
usb_init();
|
||||||
|
while(!cdcdf_acm_is_enabled()){}
|
||||||
|
cdcdf_acm_register_callback(CDCDF_ACM_CB_STATE_C, (FUNC_PTR)usb_cb_state_c);
|
||||||
|
while(!b_usb_ready){}
|
||||||
|
delay_ms(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t arc_printf(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsprintf((uint8_t*)printf_buffer, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
volatile int32_t ret = cdcdf_acm_write((uint8_t*)printf_buffer, strlen((const char*)printf_buffer));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef _SERIAL_H_
|
||||||
|
#define _SERIAL_H_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void arc_serial_init(void);
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t arc_printf(const char* fmt, ...);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define printf(f_, ...) arc_printf((f_), ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define printf(f_, ...) void(f_, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue