usbhw_i.h
Go to the documentation of this file.
1 /********************************************************************************************************
2  * @file usbhw_i.h
3  *
4  * @brief This is the header file for TLSR8258
5  *
6  * @author Driver Group
7  * @date May 8, 2018
8  *
9  * @par Copyright (c) 2018, Telink Semiconductor (Shanghai) Co., Ltd.
10  * All rights reserved.
11  *
12  * The information contained herein is confidential property of Telink
13  * Semiconductor (Shanghai) Co., Ltd. and is available under the terms
14  * of Commercial License Agreement between Telink Semiconductor (Shanghai)
15  * Co., Ltd. and the licensee or the terms described here-in. This heading
16  * MUST NOT be removed from this file.
17  *
18  * Licensees are granted free, non-transferable use of the information in this
19  * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
20  * @par History:
21  * 1.initial release(DEC. 26 2018)
22  *
23  * @version A001
24  *
25  *******************************************************************************************************/
26 
27 #pragma once
28 
29 #include "bsp.h"
30 #include "drivers.h"
31 
37 static inline void usbhw_reset_ctrl_ep_ptr(void) {
38  reg_ctrl_ep_ptr = 0;
39 }
40 
46 static inline unsigned int usbhw_get_ctrl_ep_irq(void) {
47  return reg_ctrl_ep_irq_sta;
48 }
49 
55 static inline void usbhw_clr_ctrl_ep_irq(int ep) {
56 #ifdef WIN32
58 #else
60 #endif
61 }
62 
68 static inline void usbhw_write_ctrl_ep_ctrl(unsigned char data) {
69  reg_ctrl_ep_ctrl = data;
70 }
71 
77 static inline unsigned char usbhw_read_ctrl_ep_data(void) {
78  return reg_ctrl_ep_dat;
79 }
80 
86 static inline void usbhw_write_ctrl_ep_data(unsigned char data) {
87  reg_ctrl_ep_dat = data;
88 }
89 
95 static inline int usbhw_is_ctrl_ep_busy(void) {
97 }
98 
99 
105 static inline void usbhw_reset_ep_ptr(unsigned int ep) {
106  reg_usb_ep_ptr(ep & 0x07) = 0;
107 }
108 
109 
110 
116 static inline unsigned int usbhw_get_eps_irq(void) {
117  return reg_usb_irq;
118 }
119 
120 
121 
127 static inline void usbhw_clr_eps_irq(int ep) {
128  reg_usb_irq = ep;
129 }
130 
136 static inline unsigned char usbhw_read_ep_data(unsigned int ep) {
137  return reg_usb_ep_dat(ep & 0x07);
138 }
139 
145 static inline void usbhw_write_ep_data(unsigned int ep, unsigned char data) {
146  reg_usb_ep_dat(ep & 0x07) = data;
147 }
148 
154 static inline unsigned int usbhw_is_ep_busy(unsigned int ep) {
155  return reg_usb_ep_ctrl(ep & 0x07) & FLD_USB_EP_BUSY;
156 }
157 
163 static inline void usbhw_data_ep_ack(unsigned int ep) {
164  reg_usb_ep_ctrl(ep & 0x07) = FLD_USB_EP_BUSY;
165 }
166 
172 static inline void usbhw_data_ep_stall(unsigned int ep) {
173  reg_usb_ep_ctrl(ep & 0x07) = FLD_USB_EP_STALL;
174 }
175 
176 
182 static inline void usbhw_set_printer_threshold(unsigned char th) {
184 }
static unsigned int usbhw_is_ep_busy(unsigned int ep)
This function servers to determine whether Endpoint is busy.
Definition: usbhw_i.h:154
#define reg_ctrl_ep_ctrl
Definition: register_8258.h:406
static int usbhw_is_ctrl_ep_busy(void)
This function servers to determine whether control Endpoint is busy.
Definition: usbhw_i.h:95
static unsigned int usbhw_get_eps_irq(void)
This function servers to get the irq status of Endpoint.
Definition: usbhw_i.h:116
static unsigned char usbhw_read_ep_data(unsigned int ep)
This function servers to read the data of Endpoint.
Definition: usbhw_i.h:136
static void usbhw_data_ep_ack(unsigned int ep)
This function servers to set the specified data EndPoint to ack.
Definition: usbhw_i.h:163
#define reg_ctrl_ep_dat
Definition: register_8258.h:405
static void usbhw_set_printer_threshold(unsigned char th)
This function servers to set the threshold of printer.
Definition: usbhw_i.h:182
static unsigned int usbhw_get_ctrl_ep_irq(void)
This function servers to get the irq status of control Endpoint.
Definition: usbhw_i.h:46
#define reg_usb_ep_dat(i)
Definition: register_8258.h:477
#define reg_usb_ep_ctrl(i)
Definition: register_8258.h:489
static void usbhw_write_ctrl_ep_data(unsigned char data)
This function servers to write the data of control Endpoint.
Definition: usbhw_i.h:86
static void usbhw_reset_ctrl_ep_ptr(void)
This function servers to reset the pointer of control Endpoint.
Definition: usbhw_i.h:37
#define reg_usb_ep_ptr(i)
Definition: register_8258.h:465
static void usbhw_write_ep_data(unsigned int ep, unsigned char data)
This function servers to write the data of Endpoint.
Definition: usbhw_i.h:145
static void usbhw_write_ctrl_ep_ctrl(unsigned char data)
This function servers to set the value of control Endpoint.
Definition: usbhw_i.h:68
#define reg_usb_irq
Definition: register_8258.h:521
#define reg_ctrl_ep_ptr
Definition: register_8258.h:404
static void usbhw_clr_eps_irq(int ep)
This function servers to clear the irq status of Endpoint.
Definition: usbhw_i.h:127
#define reg_usb_ep8_send_thre
Definition: register_8258.h:534
static void usbhw_clr_ctrl_ep_irq(int ep)
This function servers to clear the irq status of control Endpoint.
Definition: usbhw_i.h:55
Definition: register_8258.h:492
#define BM_CLR(x, mask)
Definition: bsp.h:40
#define reg_ctrl_ep_irq_sta
Definition: register_8258.h:415
static unsigned char usbhw_read_ctrl_ep_data(void)
This function servers to read the data of control Endpoint.
Definition: usbhw_i.h:77
static void usbhw_data_ep_stall(unsigned int ep)
This function servers to set the specified data EndPoint to stall.
Definition: usbhw_i.h:172
static void usbhw_reset_ep_ptr(unsigned int ep)
This function servers to reset the pointer of Endpoint.
Definition: usbhw_i.h:105
Definition: register_8258.h:493