2016-01-24 23:16:10 +00:00
|
|
|
/*
|
|
|
|
|
* bsp.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: Jan 22, 2016
|
|
|
|
|
* Author: pp
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef BSP_H_
|
|
|
|
|
#define BSP_H_
|
|
|
|
|
|
2016-01-25 06:14:58 +00:00
|
|
|
#include <SI_EFM8UB1_Register_Enums.h>
|
|
|
|
|
#include <efm8_usb.h>
|
2016-01-28 06:16:37 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include "descriptors.h"
|
|
|
|
|
#include "app.h"
|
2016-01-25 06:14:58 +00:00
|
|
|
|
2016-01-28 06:16:37 +00:00
|
|
|
|
2016-01-31 06:16:59 +00:00
|
|
|
extern data uint32_t _MS_;
|
2016-01-26 04:17:52 +00:00
|
|
|
extern SI_SEGMENT_VARIABLE(myUsbDevice, USBD_Device_TypeDef, MEM_MODEL_SEG);
|
2016-01-25 06:14:58 +00:00
|
|
|
|
2016-01-26 04:17:52 +00:00
|
|
|
#define get_ms() _MS_
|
2016-01-25 06:14:58 +00:00
|
|
|
|
2016-01-26 04:17:52 +00:00
|
|
|
#define GetEp(epAddr) (&myUsbDevice.ep0 + epAddr)
|
2016-01-25 06:14:58 +00:00
|
|
|
|
2016-01-26 04:17:52 +00:00
|
|
|
#define _EFMSDK16
|
|
|
|
|
#ifdef _EFMSDK16
|
|
|
|
|
SI_SBIT(LED_R, SFR_P1, 6);
|
|
|
|
|
SI_SBIT(LED_B, SFR_P1, 5);
|
|
|
|
|
SI_SBIT(LED_G, SFR_P1, 4);
|
|
|
|
|
#endif
|
2016-01-25 06:14:58 +00:00
|
|
|
|
|
|
|
|
|
2016-01-28 06:16:37 +00:00
|
|
|
void u2f_delay(int16_t ms);
|
|
|
|
|
|
|
|
|
|
void u2f_write_s(char* d);
|
|
|
|
|
void u2f_write_n(char* buf, uint32_t val, int base);
|
2016-01-24 23:16:10 +00:00
|
|
|
|
2016-01-28 06:16:37 +00:00
|
|
|
void qu2f_write_s(char* d);
|
|
|
|
|
void qu2f_write_n(char* buf, uint32_t val, int base);
|
2016-01-24 23:16:10 +00:00
|
|
|
|
2016-02-16 04:57:57 +00:00
|
|
|
|
2016-02-15 07:12:48 +00:00
|
|
|
|
|
|
|
|
|
2016-01-28 06:16:37 +00:00
|
|
|
|
|
|
|
|
#ifdef U2F_PRINT
|
2016-02-16 04:57:57 +00:00
|
|
|
|
|
|
|
|
void u2f_print(char* fmt, ...);
|
|
|
|
|
|
|
|
|
|
// not reentrant
|
|
|
|
|
void dump_hex(uint8_t* hex, uint8_t len);
|
|
|
|
|
void flush_messages();
|
|
|
|
|
|
2016-01-28 06:16:37 +00:00
|
|
|
#else
|
2016-02-16 04:57:57 +00:00
|
|
|
#define u2f_print(x)
|
|
|
|
|
#define dump_hex(x)
|
|
|
|
|
#define flush_messages(x)
|
2016-01-28 06:16:37 +00:00
|
|
|
#endif
|
2016-01-25 06:14:58 +00:00
|
|
|
|
2016-02-15 07:12:48 +00:00
|
|
|
|
2016-01-25 06:14:58 +00:00
|
|
|
|
|
|
|
|
|
2016-01-24 23:16:10 +00:00
|
|
|
#endif /* BSP_H_ */
|