Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

usb0_function.h 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*******************************************************************************
  2. * DISCLAIMER
  3. * This software is supplied by Renesas Electronics Corporation and is only
  4. * intended for use with Renesas products. No other uses are authorized. This
  5. * software is owned by Renesas Electronics Corporation and is protected under
  6. * all applicable laws, including copyright laws.
  7. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
  8. * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
  9. * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
  10. * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
  11. * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
  12. * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
  13. * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
  14. * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
  15. * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  16. * Renesas reserves the right, without notice, to make changes to this software
  17. * and to discontinue the availability of this software. By using this software,
  18. * you agree to the additional terms and conditions found by accessing the
  19. * following link:
  20. * http://www.renesas.com/disclaimer
  21. * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
  22. *******************************************************************************/
  23. /*******************************************************************************
  24. * File Name : usb0_function.h
  25. * $Rev: 1116 $
  26. * $Date:: 2014-07-09 16:29:19 +0900#$
  27. * Description : RZ/A1H R7S72100 USB Sample Program
  28. *******************************************************************************/
  29. #ifndef USB0_FUNCTION_H
  30. #define USB0_FUNCTION_H
  31. /*******************************************************************************
  32. Includes <System Includes> , "Project Includes"
  33. *******************************************************************************/
  34. #include "devdrv_usb_function_api.h"
  35. #include "usb_function.h"
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. /*******************************************************************************
  40. Typedef definitions
  41. *******************************************************************************/
  42. /*******************************************************************************
  43. Macro definitions
  44. *******************************************************************************/
  45. /*******************************************************************************
  46. Imported global variables and functions (from other files)
  47. *******************************************************************************/
  48. extern const uint16_t g_usb0_function_bit_set[];
  49. extern uint32_t g_usb0_function_data_count[USB_FUNCTION_MAX_PIPE_NO + 1];
  50. extern uint8_t *g_usb0_function_data_pointer[USB_FUNCTION_MAX_PIPE_NO + 1];
  51. extern uint16_t g_usb0_function_PipeIgnore[];
  52. extern uint16_t g_usb0_function_PipeTbl[];
  53. extern uint16_t g_usb0_function_pipe_status[];
  54. extern uint32_t g_usb0_function_PipeDataSize[];
  55. extern USB_FUNCTION_DMA_t g_usb0_function_DmaInfo[];
  56. extern uint16_t g_usb0_function_DmaPipe[];
  57. extern uint16_t g_usb0_function_DmaBval[];
  58. extern uint16_t g_usb0_function_DmaStatus[];
  59. extern uint16_t g_usb0_function_CtrZeroLengthFlag;
  60. extern uint16_t g_usb0_function_ConfigNum;
  61. extern uint16_t g_usb0_function_Alternate[USB_FUNCTION_ALT_NO];
  62. extern uint16_t g_usb0_function_RemoteWakeupFlag;
  63. extern uint16_t g_usb0_function_TestModeFlag;
  64. extern uint16_t g_usb0_function_TestModeSelectors;
  65. extern uint16_t g_usb0_function_ReqType;
  66. extern uint16_t g_usb0_function_ReqTypeType;
  67. extern uint16_t g_usb0_function_ReqTypeRecip;
  68. extern uint16_t g_usb0_function_ReqRequest;
  69. extern uint16_t g_usb0_function_ReqValue;
  70. extern uint16_t g_usb0_function_ReqIndex;
  71. extern uint16_t g_usb0_function_ReqLength;
  72. extern uint16_t g_usb0_function_EPTableIndex[USB_FUNCTION_MAX_EP_NO + 1];
  73. extern uint16_t g_usb0_function_pipecfg[USB_FUNCTION_MAX_PIPE_NO + 1];
  74. extern uint16_t g_usb0_function_pipebuf[USB_FUNCTION_MAX_PIPE_NO + 1];
  75. extern uint16_t g_usb0_function_pipemaxp[USB_FUNCTION_MAX_PIPE_NO + 1];
  76. extern uint16_t g_usb0_function_pipeperi[USB_FUNCTION_MAX_PIPE_NO + 1];
  77. /*******************************************************************************
  78. Exported global variables and functions (to be accessed by other files)
  79. *******************************************************************************/
  80. /* ==== common ==== */
  81. void usb0_function_dma_stop_d0(uint16_t pipe, uint32_t remain);
  82. void usb0_function_dma_stop_d1(uint16_t pipe, uint32_t remain);
  83. uint16_t usb0_function_is_hispeed(void);
  84. uint16_t usb0_function_is_hispeed_enable(void);
  85. uint16_t usb0_function_start_send_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
  86. uint16_t usb0_function_write_buffer(uint16_t pipe);
  87. uint16_t usb0_function_write_buffer_c(uint16_t pipe);
  88. uint16_t usb0_function_write_buffer_d0(uint16_t pipe);
  89. uint16_t usb0_function_write_buffer_d1(uint16_t pipe);
  90. void usb0_function_start_receive_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
  91. uint16_t usb0_function_read_buffer(uint16_t pipe);
  92. uint16_t usb0_function_read_buffer_c(uint16_t pipe);
  93. uint16_t usb0_function_read_buffer_d0(uint16_t pipe);
  94. uint16_t usb0_function_read_buffer_d1(uint16_t pipe);
  95. uint16_t usb0_function_change_fifo_port(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
  96. void usb0_function_set_curpipe(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
  97. void usb0_function_set_curpipe2(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw, uint16_t dfacc);
  98. uint16_t usb0_function_get_mbw(uint32_t trncount, uint32_t dtptr);
  99. uint16_t usb0_function_read_dma(uint16_t pipe);
  100. void usb0_function_brdy_int(uint16_t status, uint16_t int_enb);
  101. void usb0_function_nrdy_int(uint16_t status, uint16_t int_enb);
  102. void usb0_function_bemp_int(uint16_t status, uint16_t int_enb);
  103. void usb0_function_setting_interrupt(uint8_t level);
  104. void usb0_function_reset_module(uint16_t clockmode);
  105. uint16_t usb0_function_get_buf_size(uint16_t pipe);
  106. uint16_t usb0_function_get_mxps(uint16_t pipe);
  107. void usb0_function_clear_brdy_sts(uint16_t pipe);
  108. void usb0_function_clear_bemp_sts(uint16_t pipe);
  109. void usb0_function_clear_nrdy_sts(uint16_t pipe);
  110. void usb0_function_set_pid_buf(uint16_t pipe);
  111. void usb0_function_set_pid_nak(uint16_t pipe);
  112. void usb0_function_set_pid_stall(uint16_t pipe);
  113. void usb0_function_clear_pid_stall(uint16_t pipe);
  114. uint16_t usb0_function_get_pid(uint16_t pipe);
  115. void usb0_function_set_sqclr(uint16_t pipe);
  116. void usb0_function_set_sqset(uint16_t pipe);
  117. void usb0_function_set_csclr(uint16_t pipe);
  118. void usb0_function_aclrm(uint16_t pipe);
  119. void usb0_function_set_aclrm(uint16_t pipe);
  120. void usb0_function_clr_aclrm(uint16_t pipe);
  121. uint16_t usb0_function_get_sqmon(uint16_t pipe);
  122. uint16_t usb0_function_get_inbuf(uint16_t pipe);
  123. /* ==== function ==== */
  124. void usb0_function_init_status(void);
  125. void usb0_function_InitModule(uint16_t mode);
  126. uint16_t usb0_function_CheckVBUStaus(void);
  127. void usb0_function_USB_FUNCTION_Attach(void);
  128. void usb0_function_USB_FUNCTION_Detach(void);
  129. void usb0_function_USB_FUNCTION_BusReset(void);
  130. void usb0_function_USB_FUNCTION_Resume(void);
  131. void usb0_function_USB_FUNCTION_Suspend(void);
  132. void usb0_function_USB_FUNCTION_TestMode(void);
  133. void usb0_function_ResetDCP(void);
  134. void usb0_function_ResetEP(uint16_t num);
  135. uint16_t usb0_function_EpToPipe(uint16_t ep);
  136. void usb0_function_InitEPTable(uint16_t Con_Num, uint16_t Int_Num, uint16_t Alt_Num);
  137. uint16_t usb0_function_GetConfigNum(void);
  138. uint16_t usb0_function_GetAltNum(uint16_t Con_Num, uint16_t Int_Num);
  139. uint16_t usb0_function_CheckRemoteWakeup(void);
  140. void usb0_function_clear_alt(void);
  141. void usb0_function_clear_pipe_tbl(void);
  142. void usb0_function_clear_ep_table_index(void);
  143. uint16_t usb0_function_GetInterfaceNum(uint16_t num);
  144. #ifdef __cplusplus
  145. }
  146. #endif
  147. #endif /* USB0_FUNCTION_H */
  148. /* End of File */