aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.h
blob: 95ce375685f76f351275ea482889ecdad3d193c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/************************************************************************************
 * this module is represents the access layer to USB STACK DRIVER
 * used to communication over USB protocol
 * the USB protocol implementation is inside the module no need for another includes
 *  ======== USBCDCD.h ========
 ************************************************************************************/

#ifndef USBCDCD_H_
#define USBCDCD_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <xdc/std.h>
#include <stdbool.h>
#include "include.h"

/******************************************************************
 *  ======== USBCDCD_init ========
 *  Function to initialize the USB serial reference module.
 *
 *  Note: This function is not reentrant safe.
 ******************************************************************/

void USBCDCD_init(void);

/****************************************************************************
 *  ======== USBCDCD_sendData ========
 *  A blocking function that sends a specified amount of data.
 *
 *  Function sends _size number of bytes from the buffer pointed by _pBuff.
 *
 *  @param(_pBuff)    Pointer to a buffer of data
 *
 *  @param(_size)    Number of bytes to be sent
 *
 *  @return         Number of bytes added to the USB Buffer for transmission
 ******************************************************************************/

unsigned int USBCDCD_sendData(const unsigned char *_pBuff,
                              unsigned int _length,
                              unsigned int _timeout);

/**********************************************************************************
 *  ======== USBCDCD_receiveData ========
 *  A blocking function to read from the USB Buffer
 *
 *  Function reads up to _size number of bytes from the USB Buffer. The return
 *  value will indicate how many bytes were read from the USB Buffer. If there
 *  is no data in the USB Buffer, this function will block timeout number of
 *  ticks. Note: The BIOS_WAIT_FOREVER macro can be used to block indefinitely.
 *
 *  @param(_pBuff)    Pointer to a buffer to which data is written to.
 *
 *  @param(_length)    Maximum number of bytes to be read
 *
 *  @param(_timeout) Number of tick to block if no data is currently available in
 *                  the USB Buffer.
 *
 *  @return         Returns the number of bytes actually read from the USB
 *                  Buffer.
 **********************************************************************************/

unsigned int USBCDCD_receiveData(unsigned char *_pBuff, unsigned int _length, unsigned int _timeout);


/**********************************************************
 *  ======== USBCDCD_waitForConnect ========
 *  This function blocks while the USB is not connected
 **********************************************************/

bool USBCDCD_waitForConnect(unsigned int _timeout);

void USBCDCD_Reinit(void);

void USBCDCD_hwiHandler(UArg arg0);

extern bool UpdateFlag;

//bool SendChars(char* buffer,size_t length);
#ifdef __cplusplus
}
#endif

#endif /* USBCDCD_H_ */