Commits

Anonymous committed 6fe542f

tryfix : ipm now work, don't know why getchr should print some char. This should be improve

Comments (0)

Files changed (2)

src/platform/stm32f4/plat.c

 extern volatile uint32_t fCNT_tick;
 extern volatile uint32_t dCNT_tick[];
 
+extern int16_t USART2_getc(void);
+extern void USART2_putc(char);
+extern void USART2_puts(char *);
+
+#define putstr	USART2_puts
+#define putch	USART2_putc
+#define getch	USART2_getc
 
 /*
  * Retargets the C library printf function to the USART.
     int c;
     PmReturn_t retval = PM_RET_OK;
 
-	c= getchar();
+	c= getch();
 
     *b = c & 0xFF;
 
 PmReturn_t
 plat_putByte(uint8_t b)
 {
-	putchar(b);
+	putch(b);
     return PM_RET_OK;
 }
 

src/platform/stm32f4/usart.h

 #include "stm32f4xx.h"
 #include "core_cm4.h"
 #include "sysclk_config.h"
+#include <stdio.h>
 
 struct USART_BUF_CTRL_t {
 	uint8_t err_flag;
 // RX��M�o�b�t�@����̏ꍇ�́C-1��Ԃ�
 //
 static int16_t sci_getRxBuf(void){
-int16_t r;
+    printf("                   \n");
+    int16_t r;
 	if(0 == sci.rb_siz){  // ��o�b�t�@�����O�̏ꍇ
 		if(is_sr_RDRF){ // RDR�Ƀf�[�^�������Ă���΂��̒l���^�[������
 			r= SCI->DR; return(r);
 		if( sci.rb_r >= sci.rb_siz )sci.rb_r= 0;
 	UEI; // exit the critical section
 //	if(SCI_nbuf()<(sci.rb_siz/2))SCI_set_RTS; // �o�b�t�@�������ȏ�󂢂���RTS��on
+    printf("                 \n");
 	return(r);
 }