Rev 112 | Rev 275 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 112 | Rev 270 | ||
---|---|---|---|
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" |
23 | #include "usb.h" |
24 | #include "mkprotocol.h" |
24 | #include "mkprotocol.h" |
25 | 25 | ||
26 | /* Private typedef -----------------------------------------------------------*/ |
26 | /* Private typedef -----------------------------------------------------------*/ |
27 | /* Private define ------------------------------------------------------------*/ |
27 | /* Private define ------------------------------------------------------------*/ |
28 | /* Private macro -------------------------------------------------------------*/ |
28 | /* Private macro -------------------------------------------------------------*/ |
29 | /* Private variables ---------------------------------------------------------*/ |
29 | /* Private variables ---------------------------------------------------------*/ |
30 | u8 USB_Buffer[VIRTUAL_COM_PORT_DATA_SIZE]; |
30 | u8 USB_Buffer[VIRTUAL_COM_PORT_DATA_SIZE]; |
31 | u32 USB_BufferCount =0; |
31 | u32 USB_BufferCount =0; |
32 | u32 count_in = 0; |
32 | u32 count_in = 0; |
33 | /* Private function prototypes -----------------------------------------------*/ |
33 | /* Private function prototypes -----------------------------------------------*/ |
34 | /* Private functions ---------------------------------------------------------*/ |
34 | /* Private functions ---------------------------------------------------------*/ |
35 | /******************************************************************************* |
35 | /******************************************************************************* |
36 | * Function Name : EP3_IN_Callback |
36 | * Function Name : EP3_IN_Callback |
37 | * Description : |
37 | * Description : |
38 | * Input : None. |
38 | * Input : None. |
39 | * Output : None. |
39 | * Output : None. |
40 | * Return : None. |
40 | * Return : None. |
41 | *******************************************************************************/ |
41 | *******************************************************************************/ |
42 | void EP3_OUT_Callback(void) |
42 | void EP3_OUT_Callback(void) |
43 | { |
43 | { |
44 | u32 i; |
44 | u32 i; |
45 | USB_BufferCount = GetEPRxCount(ENDP3); |
45 | USB_BufferCount = GetEPRxCount(ENDP3); |
46 | PMAToUserBufferCopy(USB_Buffer, ENDP3_RXADDR, USB_BufferCount ); |
46 | PMAToUserBufferCopy(USB_Buffer, ENDP3_RXADDR, USB_BufferCount ); |
47 | for(i=0; i<USB_BufferCount; i++) |
47 | for(i=0; i<USB_BufferCount; i++) |
48 | { |
48 | { |
49 | MKProtocol_CollectSerialFrame(&USB_rx_buffer, USB_Buffer[i]); |
49 | MKProtocol_CollectSerialFrame(&USB_rx_buffer, USB_Buffer[i]); |
50 | } |
50 | } |
51 | SetEPRxValid(ENDP3); |
51 | SetEPRxValid(ENDP3); |
52 | 52 | ||
53 | //sprintf(text,"USB (%ld): %s\n\r", USB_BufferRxCount, USB_BufferRx); |
53 | //sprintf(text,"USB (%ld): %s\n\r", USB_Buffer, USB_BufferCount); |
54 | //UART1_PutString(text); |
54 | //UART1_PutString(text); |
55 | } |
55 | } |
56 | /******************************************************************************* |
56 | /******************************************************************************* |
57 | * Function Name : EP1_IN_Callback |
57 | * Function Name : EP1_IN_Callback |
58 | * Description : |
58 | * Description : |
59 | * Input : None. |
59 | * Input : None. |
60 | * Output : None. |
60 | * Output : None. |
61 | * Return : None. |
61 | * Return : None. |
62 | *******************************************************************************/ |
62 | *******************************************************************************/ |
63 | void EP1_IN_Callback(void) |
63 | void EP1_IN_Callback(void) |
64 | { |
64 | { |
65 | count_in =0; |
65 | count_in =0; |
66 | } |
66 | } |
67 | /******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ |
67 | /******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ |
68 | 68 | ||
69 | 69 |