|
@@ -136,38 +136,68 @@ int serial_update_buffers()
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#define TID_SEND_ADJUST 2
|
|
+#if __GNUC__ < 6
|
|
|
|
+ #define TID_SEND_ADJUST 14
|
|
|
|
+#else
|
|
|
|
+ #define TID_SEND_ADJUST 2
|
|
|
|
+#endif
|
|
|
|
|
|
#if SELECT_SOFT_SERIAL_SPEED == 0
|
|
#if SELECT_SOFT_SERIAL_SPEED == 0
|
|
|
|
|
|
#define SERIAL_DELAY 4
|
|
#define SERIAL_DELAY 4
|
|
- #define READ_WRITE_START_ADJUST 33
|
|
+ #if __GNUC__ < 6
|
|
- #define READ_WRITE_WIDTH_ADJUST 6
|
|
+ #define READ_WRITE_START_ADJUST 33
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 3
|
|
|
|
+ #else
|
|
|
|
+ #define READ_WRITE_START_ADJUST 34
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 7
|
|
|
|
+ #endif
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 1
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 1
|
|
|
|
|
|
#define SERIAL_DELAY 6
|
|
#define SERIAL_DELAY 6
|
|
- #define READ_WRITE_START_ADJUST 30
|
|
+ #if __GNUC__ < 6
|
|
- #define READ_WRITE_WIDTH_ADJUST 7
|
|
+ #define READ_WRITE_START_ADJUST 30
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 3
|
|
|
|
+ #else
|
|
|
|
+ #define READ_WRITE_START_ADJUST 33
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 7
|
|
|
|
+ #endif
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 2
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 2
|
|
|
|
|
|
#define SERIAL_DELAY 12
|
|
#define SERIAL_DELAY 12
|
|
#define READ_WRITE_START_ADJUST 30
|
|
#define READ_WRITE_START_ADJUST 30
|
|
- #define READ_WRITE_WIDTH_ADJUST 7
|
|
+ #if __GNUC__ < 6
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 3
|
|
|
|
+ #else
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 7
|
|
|
|
+ #endif
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 3
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 3
|
|
|
|
|
|
#define SERIAL_DELAY 24
|
|
#define SERIAL_DELAY 24
|
|
#define READ_WRITE_START_ADJUST 30
|
|
#define READ_WRITE_START_ADJUST 30
|
|
- #define READ_WRITE_WIDTH_ADJUST 7
|
|
+ #if __GNUC__ < 6
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 3
|
|
|
|
+ #else
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 7
|
|
|
|
+ #endif
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 4
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 4
|
|
|
|
|
|
#define SERIAL_DELAY 36
|
|
#define SERIAL_DELAY 36
|
|
#define READ_WRITE_START_ADJUST 30
|
|
#define READ_WRITE_START_ADJUST 30
|
|
- #define READ_WRITE_WIDTH_ADJUST 7
|
|
+ #if __GNUC__ < 6
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 3
|
|
|
|
+ #else
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 7
|
|
|
|
+ #endif
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 5
|
|
#elif SELECT_SOFT_SERIAL_SPEED == 5
|
|
|
|
|
|
#define SERIAL_DELAY 48
|
|
#define SERIAL_DELAY 48
|
|
#define READ_WRITE_START_ADJUST 30
|
|
#define READ_WRITE_START_ADJUST 30
|
|
- #define READ_WRITE_WIDTH_ADJUST 7
|
|
+ #if __GNUC__ < 6
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 3
|
|
|
|
+ #else
|
|
|
|
+ #define READ_WRITE_WIDTH_ADJUST 7
|
|
|
|
+ #endif
|
|
#else
|
|
#else
|
|
#error invalid SELECT_SOFT_SERIAL_SPEED value
|
|
#error invalid SELECT_SOFT_SERIAL_SPEED value
|
|
#endif
|
|
#endif
|
|
@@ -187,16 +217,19 @@ int serial_update_buffers()
|
|
static SSTD_t *Transaction_table = NULL;
|
|
static SSTD_t *Transaction_table = NULL;
|
|
static uint8_t Transaction_table_size = 0;
|
|
static uint8_t Transaction_table_size = 0;
|
|
|
|
|
|
|
|
+inline static void serial_delay(void) ALWAYS_INLINE;
|
|
inline static
|
|
inline static
|
|
void serial_delay(void) {
|
|
void serial_delay(void) {
|
|
_delay_us(SERIAL_DELAY);
|
|
_delay_us(SERIAL_DELAY);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+inline static void serial_delay_half1(void) ALWAYS_INLINE;
|
|
inline static
|
|
inline static
|
|
void serial_delay_half1(void) {
|
|
void serial_delay_half1(void) {
|
|
_delay_us(SERIAL_DELAY_HALF1);
|
|
_delay_us(SERIAL_DELAY_HALF1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+inline static void serial_delay_half2(void) ALWAYS_INLINE;
|
|
inline static
|
|
inline static
|
|
void serial_delay_half2(void) {
|
|
void serial_delay_half2(void) {
|
|
_delay_us(SERIAL_DELAY_HALF2);
|
|
_delay_us(SERIAL_DELAY_HALF2);
|
|
@@ -216,6 +249,7 @@ void serial_input_with_pullup(void) {
|
|
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
|
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+inline static uint8_t serial_read_pin(void) ALWAYS_INLINE;
|
|
inline static
|
|
inline static
|
|
uint8_t serial_read_pin(void) {
|
|
uint8_t serial_read_pin(void) {
|
|
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
|
|
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
|
|
@@ -270,7 +304,7 @@ void sync_recv(void) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static void sync_send(void)NO_INLINE;
|
|
+static void sync_send(void) NO_INLINE;
|
|
static
|
|
static
|
|
void sync_send(void) {
|
|
void sync_send(void) {
|
|
serial_low();
|
|
serial_low();
|