Rev 111 | Rev 270 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 111 | Rev 112 | ||
---|---|---|---|
1 | /******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** |
1 | /******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** |
2 | * File Name : usb_endp.c |
2 | * File Name : usb_endp.c |
3 | * Author : MCD Application Team |
3 | * Author : MCD Application Team |
4 | * Date First Issued : 10/01/2006 : V1.0 |
4 | * Date First Issued : 10/01/2006 : V1.0 |
5 | * Description : Endpoint routines |
5 | * Description : Endpoint routines |
6 | ******************************************************************************** |
6 | ******************************************************************************** |
7 | * History: |
7 | * History: |
8 | * 10/01/2006 : V1.0 |
8 | * 10/01/2006 : V1.0 |
9 | ******************************************************************************** |
9 | ******************************************************************************** |
10 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
10 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
11 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
11 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
12 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
12 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
13 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
13 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
14 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
14 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
15 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
15 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
16 | *******************************************************************************/ |
16 | *******************************************************************************/ |
17 | /* Includes ------------------------------------------------------------------*/ |
17 | /* Includes ------------------------------------------------------------------*/ |
18 | #include <stdio.h> |
18 | #include <stdio.h> |
19 | #include "91x_lib.h" |
19 | #include "91x_lib.h" |
20 | #include "uart1.h" |
20 | #include "uart1.h" |
21 | #include "usb_lib.h" |
21 | #include "usb_lib.h" |
22 | #include "usb_desc.h" |
22 | #include "usb_desc.h" |
- | 23 | #include "usb.h" |
|
- | 24 | #include "mkprotocol.h" |
|
23 | 25 | ||
24 | /* Private typedef -----------------------------------------------------------*/ |
26 | /* Private typedef -----------------------------------------------------------*/ |
25 | /* Private define ------------------------------------------------------------*/ |
27 | /* Private define ------------------------------------------------------------*/ |
26 | /* Private macro -------------------------------------------------------------*/ |
28 | /* Private macro -------------------------------------------------------------*/ |
27 | /* Private variables ---------------------------------------------------------*/ |
29 | /* Private variables ---------------------------------------------------------*/ |
28 | u8 USB_BufferRx[VIRTUAL_COM_PORT_DATA_SIZE]; |
- | |
29 | u8 USB_BufferTx[VIRTUAL_COM_PORT_DATA_SIZE]; |
30 | u8 USB_Buffer[VIRTUAL_COM_PORT_DATA_SIZE]; |
30 | u32 USB_BufferRxCount =0; |
31 | u32 USB_BufferCount =0; |
31 | u32 count_in = 0; |
32 | u32 count_in = 0; |
32 | /* Private function prototypes -----------------------------------------------*/ |
33 | /* Private function prototypes -----------------------------------------------*/ |
33 | /* Private functions ---------------------------------------------------------*/ |
34 | /* Private functions ---------------------------------------------------------*/ |
34 | /******************************************************************************* |
35 | /******************************************************************************* |
35 | * Function Name : EP3_IN_Callback |
36 | * Function Name : EP3_IN_Callback |
36 | * Description : |
37 | * Description : |
37 | * Input : None. |
38 | * Input : None. |
38 | * Output : None. |
39 | * Output : None. |
39 | * Return : None. |
40 | * Return : None. |
40 | *******************************************************************************/ |
41 | *******************************************************************************/ |
41 | void EP3_OUT_Callback(void) |
42 | void EP3_OUT_Callback(void) |
42 | { |
43 | { |
- | 44 | u32 i; |
|
43 | USB_BufferRxCount= GetEPRxCount(ENDP3); |
45 | USB_BufferCount = GetEPRxCount(ENDP3); |
44 | PMAToUserBufferCopy(USB_BufferRx, ENDP3_RXADDR, USB_BufferRxCount ); |
46 | PMAToUserBufferCopy(USB_Buffer, ENDP3_RXADDR, USB_BufferCount ); |
- | 47 | for(i=0; i<USB_BufferCount; i++) |
|
- | 48 | { |
|
45 | USB_BufferRx[USB_BufferRxCount] = 0; // terminate buffer contents |
49 | MKProtocol_CollectSerialFrame(&USB_rx_buffer, USB_Buffer[i]); |
- | 50 | } |
|
46 | SetEPRxValid(ENDP3); |
51 | SetEPRxValid(ENDP3); |
47 | 52 | ||
48 | sprintf(text,"USB (%ld): %s\n\r", USB_BufferRxCount, USB_BufferRx); |
53 | //sprintf(text,"USB (%ld): %s\n\r", USB_BufferRxCount, USB_BufferRx); |
49 | UART1_PutString(text); |
- | |
50 | - | ||
51 | // USB_Send_Data(RxdBuffer, AnzahlEmpfangsBytes); |
- | |
52 | // USB_Send_String("Rx.\0"); |
54 | //UART1_PutString(text); |
53 | } |
55 | } |
54 | /******************************************************************************* |
56 | /******************************************************************************* |
55 | * Function Name : EP1_IN_Callback |
57 | * Function Name : EP1_IN_Callback |
56 | * Description : |
58 | * Description : |
57 | * Input : None. |
59 | * Input : None. |
58 | * Output : None. |
60 | * Output : None. |
59 | * Return : None. |
61 | * Return : None. |
60 | *******************************************************************************/ |
62 | *******************************************************************************/ |
61 | void EP1_IN_Callback(void) |
63 | void EP1_IN_Callback(void) |
62 | { |
64 | { |
63 | count_in =0; |
65 | count_in =0; |
64 | } |
66 | } |
65 | /******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ |
67 | /******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ |
66 | 68 | ||
67 | 69 |