at32f403a_407_emac.h 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709
  1. /**
  2. **************************************************************************
  3. * @file at32f403a_407_emac.h
  4. * @brief at32f403a_407 emac header file
  5. **************************************************************************
  6. * Copyright notice & Disclaimer
  7. *
  8. * The software Board Support Package (BSP) that is made available to
  9. * download from Artery official website is the copyrighted work of Artery.
  10. * Artery authorizes customers to use, copy, and distribute the BSP
  11. * software and its related documentation for the purpose of design and
  12. * development in conjunction with Artery microcontrollers. Use of the
  13. * software is governed by this copyright notice and the following disclaimer.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  16. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  17. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  18. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  19. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  21. *
  22. **************************************************************************
  23. */
  24. /* Define to prevent recursive inclusion -------------------------------------*/
  25. #ifndef __AT32F403A_407_EMAC_H
  26. #define __AT32F403A_407_EMAC_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "at32f403a_407.h"
  32. /** @addtogroup AT32F403A_407_periph_driver
  33. * @{
  34. */
  35. /** @addtogroup EMAC
  36. * @{
  37. */
  38. #define PHY_TIMEOUT (0x000FFFFF) /*!< timeout for phy response */
  39. /** @defgroup EMAC_smi_clock_border_definition
  40. * @brief emac smi clock border
  41. * @{
  42. */
  43. #define EMAC_HCLK_BORDER_20MHZ (20000000) /*!< hclk boarder of 20 mhz */
  44. #define EMAC_HCLK_BORDER_35MHZ (35000000) /*!< hclk boarder of 35 mhz */
  45. #define EMAC_HCLK_BORDER_60MHZ (60000000) /*!< hclk boarder of 60 mhz */
  46. #define EMAC_HCLK_BORDER_100MHZ (100000000) /*!< hclk boarder of 100 mhz */
  47. #define EMAC_HCLK_BORDER_150MHZ (150000000) /*!< hclk boarder of 150 mhz */
  48. #define EMAC_HCLK_BORDER_240MHZ (240000000) /*!< hclk boarder of 240 mhz */
  49. /**
  50. * @}
  51. */
  52. /** @defgroup EMAC_interrupts_definition
  53. * @brief emac interrupts
  54. * @{
  55. */
  56. #define EMAC_PMT_FLAG ((uint32_t)0x00000008) /*!< interrupt bit of pmt */
  57. #define EMAC_MMC_FLAG ((uint32_t)0x00000010) /*!< interrupt bit of mmc */
  58. #define EMAC_MMCR_FLAG ((uint32_t)0x00000020) /*!< interrupt bit of mmcr */
  59. #define EMAC_MMCT_FLAG ((uint32_t)0x00000040) /*!< interrupt bit of mmct */
  60. #define EMAC_TST_FLAG ((uint32_t)0x00000200) /*!< interrupt bit of tst */
  61. /**
  62. * @}
  63. */
  64. /** @defgroup EMAC_mmc_flags_definition
  65. * @brief emac mmc flags
  66. * @{
  67. */
  68. #define MMC_RX_CRC_ERROR ((uint32_t)0x00000020) /*!< mmc error flag of rx crc */
  69. #define MMC_RX_ALIGN_ERROR ((uint32_t)0x00000040) /*!< mmc error flag of rx alignment */
  70. #define MMC_RX_GOOD_UNICAST ((uint32_t)0x00020000) /*!< mmc error flag of rx unicast good frames */
  71. #define MMC_TX_SINGLE_COL ((uint32_t)0x00004000) /*!< mmc error flag of tx single collision */
  72. #define MMC_TX_MULTIPLE_COL ((uint32_t)0x00008000) /*!< mmc error flag of tx multiple collision */
  73. #define MMC_TX_GOOD_FRAMES ((uint32_t)0x00200000) /*!< mmc error flag of tx good frames */
  74. /**
  75. * @}
  76. */
  77. /** @defgroup EMAC_packet_definition
  78. * @brief emac packet
  79. * @{
  80. */
  81. #define EMAC_MAX_PACKET_LENGTH 1524 /*!< emac_header + emac_extra + emac_max_payload + emac_crc */
  82. #define EMAC_HEADER 14 /*!< 6 byte dest addr, 6 byte src addr, 2 byte length/ept_type */
  83. #define EMAC_CRC 4 /*!< ethernet crc */
  84. #define EMAC_EXTRA 2 /*!< extra bytes in some cases */
  85. #define VLAN_TAG 4 /*!< optional 802.1q vlan tag */
  86. #define EMAC_MIN_PAYLOAD 46 /*!< minimum ethernet payload size */
  87. #define EMAC_MAX_PAYLOAD 1500 /*!< maximum ethernet payload size */
  88. #define JUMBO_FRAME_PAYLOAD 9000 /*!< jumbo frame payload size */
  89. #define EMAC_DMARXDESC_FRAME_LENGTHSHIFT 16
  90. /**
  91. * @}
  92. */
  93. /** @defgroup EMAC_dma_descriptor_tdes0_definition
  94. * @brief tdes0 definition
  95. * @{
  96. */
  97. #define EMAC_DMATXDESC_OWN ((uint32_t)0x80000000) /*!< own bit: descriptor is owned by dma engine */
  98. #define EMAC_DMATXDESC_IC ((uint32_t)0x40000000) /*!< interrupt on completion */
  99. #define EMAC_DMATXDESC_LS ((uint32_t)0x20000000) /*!< last segment */
  100. #define EMAC_DMATXDESC_FS ((uint32_t)0x10000000) /*!< first segment */
  101. #define EMAC_DMATXDESC_DC ((uint32_t)0x08000000) /*!< disable crc */
  102. #define EMAC_DMATXDESC_DP ((uint32_t)0x04000000) /*!< disable padding */
  103. #define EMAC_DMATXDESC_TTSE ((uint32_t)0x02000000) /*!< transmit time stamp enable */
  104. #define EMAC_DMATXDESC_CIC ((uint32_t)0x00C00000) /*!< checksum insertion control: 4 cases */
  105. #define EMAC_DMATXDESC_CIC_BYPASS ((uint32_t)0x00000000) /*!< do nothing: checksum engine is bypassed */
  106. #define EMAC_DMATXDESC_CIC_IPV4HEADER ((uint32_t)0x00400000) /*!< ipv4 header checksum insertion */
  107. #define EMAC_DMATXDESC_CIC_TUI_SEG ((uint32_t)0x00800000) /*!< tcp/udp/icmp checksum insertion calculated over segment only */
  108. #define EMAC_DMATXDESC_CIC_TUI_FULL ((uint32_t)0x00C00000) /*!< tcp/udp/icmp checksum insertion fully calculated */
  109. #define EMAC_DMATXDESC_TER ((uint32_t)0x00200000) /*!< transmit end of ring */
  110. #define EMAC_DMATXDESC_TCH ((uint32_t)0x00100000) /*!< second address chained */
  111. #define EMAC_DMATXDESC_TTSS ((uint32_t)0x00020000) /*!< tx time stamp status */
  112. #define EMAC_DMATXDESC_IHE ((uint32_t)0x00010000) /*!< ip header error */
  113. #define EMAC_DMATXDESC_ES ((uint32_t)0x00008000) /*!< error summary: or of the following bits: ue || ED || EC || LCO || NC || LCA || FF || JT */
  114. #define EMAC_DMATXDESC_JT ((uint32_t)0x00004000) /*!< jabber timeout */
  115. #define EMAC_DMATXDESC_FF ((uint32_t)0x00002000) /*!< frame flushed: dma/mtl flushed the frame due to SW flush */
  116. #define EMAC_DMATXDESC_PCE ((uint32_t)0x00001000) /*!< payload checksum error */
  117. #define EMAC_DMATXDESC_LCA ((uint32_t)0x00000800) /*!< loss of carrier: carrier lost during tramsmission */
  118. #define EMAC_DMATXDESC_NC ((uint32_t)0x00000400) /*!< no carrier: no carrier signal from the tranceiver */
  119. #define EMAC_DMATXDESC_LCO ((uint32_t)0x00000200) /*!< late collision: transmission aborted due to collision */
  120. #define EMAC_DMATXDESC_EC ((uint32_t)0x00000100) /*!< excessive collision: transmission aborted after 16 collisions */
  121. #define EMAC_DMATXDESC_VF ((uint32_t)0x00000080) /*!< vlan frame */
  122. #define EMAC_DMATXDESC_CC ((uint32_t)0x00000078) /*!< collision count */
  123. #define EMAC_DMATXDESC_ED ((uint32_t)0x00000004) /*!< excessive deferral */
  124. #define EMAC_DMATXDESC_UF ((uint32_t)0x00000002) /*!< underflow error: late data arrival from the memory */
  125. #define EMAC_DMATXDESC_DB ((uint32_t)0x00000001) /*!< deferred bit */
  126. /**
  127. * @}
  128. */
  129. /** @defgroup EMAC_dma_descriptor_tdes1_definition
  130. * @brief tdes1 descriptor
  131. * @{
  132. */
  133. #define EMAC_DMATXDESC_TBS2 ((uint32_t)0x1FFF0000) /*!< transmit buffer2 size */
  134. #define EMAC_DMATXDESC_TBS1 ((uint32_t)0x00001FFF) /*!< transmit buffer1 size */
  135. /**
  136. * @}
  137. */
  138. /** @defgroup EMAC_dma_descriptor_tdes2_definition
  139. * @brief tdes2 descriptor
  140. * @{
  141. */
  142. #define EMAC_DMATXDESC_B1AP ((uint32_t)0xFFFFFFFF) /*!< buffer1 address pointer */
  143. /**
  144. * @}
  145. */
  146. /** @defgroup EMAC_dma_descriptor_tdes3_definition
  147. * @brief tdes3 descriptor
  148. * @{
  149. */
  150. #define EMAC_DMATxDesc_B2AP ((uint32_t)0xFFFFFFFF) /*!< buffer2 address pointer */
  151. /**
  152. * @}
  153. */
  154. /** @defgroup EMAC_dma_descriptor_rdes0_definition
  155. * @brief rdes0 descriptor
  156. * @{
  157. */
  158. #define EMAC_DMARXDESC_OWN ((uint32_t)0x80000000) /*!< own bit: descriptor is owned by dma engine */
  159. #define EMAC_DMARXDESC_AFM ((uint32_t)0x40000000) /*!< da filter fail for the rx frame */
  160. #define EMAC_DMARXDESC_FL ((uint32_t)0x3FFF0000) /*!< receive descriptor frame length */
  161. #define EMAC_DMARXDESC_ES ((uint32_t)0x00008000) /*!< error summary: or of the following bits: de || OE || IPC || LC || RWT || RE || CE */
  162. #define EMAC_DMARXDESC_DE ((uint32_t)0x00004000) /*!< desciptor error: no more descriptors for receive frame */
  163. #define EMAC_DMARXDESC_SAF ((uint32_t)0x00002000) /*!< sa filter fail for the received frame */
  164. #define EMAC_DMARXDESC_LE ((uint32_t)0x00001000) /*!< frame size not matching with length field */
  165. #define EMAC_DMARXDESC_OE ((uint32_t)0x00000800) /*!< overflow error: frame was damaged due to buffer overflow */
  166. #define EMAC_DMARXDESC_VLAN ((uint32_t)0x00000400) /*!< vlan tag: received frame is a vlan frame */
  167. #define EMAC_DMARXDESC_FS ((uint32_t)0x00000200) /*!< first descriptor of the frame */
  168. #define EMAC_DMARXDESC_LS ((uint32_t)0x00000100) /*!< last descriptor of the frame */
  169. #define EMAC_DMARXDESC_IPV4HCE ((uint32_t)0x00000080) /*!< ipc checksum error: rx ipv4 header checksum error */
  170. #define EMAC_DMARXDESC_LC ((uint32_t)0x00000040) /*!< late collision occurred during reception */
  171. #define EMAC_DMARXDESC_FT ((uint32_t)0x00000020) /*!< frame ept_type - ethernet, otherwise 802.3 */
  172. #define EMAC_DMARXDESC_RWT ((uint32_t)0x00000010) /*!< receive watchdog timeout: watchdog timer expired during reception */
  173. #define EMAC_DMARXDESC_RE ((uint32_t)0x00000008) /*!< receive error: error reported by mii interface */
  174. #define EMAC_DMARXDESC_DBE ((uint32_t)0x00000004) /*!< dribble bit error: frame contains non int multiple of 8 bits */
  175. #define EMAC_DMARXDESC_CE ((uint32_t)0x00000002) /*!< crc error */
  176. #define EMAC_DMARXDESC_MAMPCE ((uint32_t)0x00000001) /*!< rx mac address/payload checksum error: rx mac address matched/ Rx Payload Checksum Error */
  177. /**
  178. * @}
  179. */
  180. /** @defgroup EMAC_dma_descriptor_rdes1_definition
  181. * @brief rdes1 descriptor
  182. * @{
  183. */
  184. #define EMAC_DMARXDESC_DIC ((uint32_t)0x80000000) /*!< disable interrupt on completion */
  185. #define EMAC_DMARXDESC_RBS2 ((uint32_t)0x1FFF0000) /*!< receive buffer2 size */
  186. #define EMAC_DMARXDESC_RER ((uint32_t)0x00008000) /*!< receive end of ring */
  187. #define EMAC_DMARXDESC_RCH ((uint32_t)0x00004000) /*!< second address chained */
  188. #define EMAC_DMARXDESC_RBS1 ((uint32_t)0x00001FFF) /*!< receive buffer1 size */
  189. /**
  190. * @}
  191. */
  192. /** @defgroup EMAC_dma_descriptor_rdes2_definition
  193. * @brief rdes2 descriptor
  194. * @{
  195. */
  196. #define EMAC_DMARXDESC_B1AP ((uint32_t)0xFFFFFFFF) /*!< buffer1 address pointer */
  197. /**
  198. * @}
  199. */
  200. /** @defgroup EMAC_dma_descriptor_rdes3_definition
  201. * @brief rdes3 descriptor
  202. * @{
  203. */
  204. #define EMAC_DMARXDESC_B2AP ((uint32_t)0xFFFFFFFF) /*!< buffer2 address pointer */
  205. /**
  206. * @}
  207. */
  208. /**
  209. * @brief emac dma flag
  210. */
  211. #define EMAC_DMA_TI_FLAG ((uint32_t)0x00000001) /*!< emac dma transmit interrupt */
  212. #define EMAC_DMA_TPS_FLAG ((uint32_t)0x00000002) /*!< emac dma transmit process stopped */
  213. #define EMAC_DMA_TBU_FLAG ((uint32_t)0x00000004) /*!< emac dma transmit buffer unavailable */
  214. #define EMAC_DMA_TJT_FLAG ((uint32_t)0x00000008) /*!< emac dma transmit jabber timeout */
  215. #define EMAC_DMA_OVF_FLAG ((uint32_t)0x00000010) /*!< emac dma receive overflow */
  216. #define EMAC_DMA_UNF_FLAG ((uint32_t)0x00000020) /*!< emac dma transmit underflow */
  217. #define EMAC_DMA_RI_FLAG ((uint32_t)0x00000040) /*!< emac dma receive interrupt */
  218. #define EMAC_DMA_RBU_FLAG ((uint32_t)0x00000080) /*!< emac dma receive buffer unavailable */
  219. #define EMAC_DMA_RPS_FLAG ((uint32_t)0x00000100) /*!< emac dma receive process stopped */
  220. #define EMAC_DMA_RWT_FLAG ((uint32_t)0x00000200) /*!< emac dma receive watchdog timeout */
  221. #define EMAC_DMA_ETI_FLAG ((uint32_t)0x00000400) /*!< emac dma early transmit interrupt */
  222. #define EMAC_DMA_FBEI_FLAG ((uint32_t)0x00002000) /*!< emac dma fatal bus error interrupt */
  223. #define EMAC_DMA_ERI_FLAG ((uint32_t)0x00004000) /*!< emac dma early receive interrupt */
  224. #define EMAC_DMA_AIS_FLAG ((uint32_t)0x00008000) /*!< emac dma abnormal interrupt summary */
  225. #define EMAC_DMA_NIS_FLAG ((uint32_t)0x00010000) /*!< emac dma normal interrupt summary */
  226. /** @defgroup EMAC_exported_types
  227. * @{
  228. */
  229. /**
  230. * @brief emac auto negotiation type
  231. */
  232. typedef enum
  233. {
  234. EMAC_AUTO_NEGOTIATION_OFF = 0x00, /*!< disable auto negotiation */
  235. EMAC_AUTO_NEGOTIATION_ON = 0x01 /*!< enable auto negotiation */
  236. } emac_auto_negotiation_type;
  237. /**
  238. * @brief emac back_off limit type
  239. */
  240. typedef enum
  241. {
  242. EMAC_BACKOFF_LIMIT_0 = 0x00, /*!< retransmission clock gap numbers betwenn n and 10 */
  243. EMAC_BACKOFF_LIMIT_1 = 0x01, /*!< retransmission clock gap numbers betwenn n and 8 */
  244. EMAC_BACKOFF_LIMIT_2 = 0x02, /*!< retransmission clock gap numbers betwenn n and 4 */
  245. EMAC_BACKOFF_LIMIT_3 = 0x03 /*!< retransmission clock gap numbers betwenn n and 1 */
  246. } emac_bol_type;
  247. /**
  248. * @brief emac duplex type
  249. */
  250. typedef enum
  251. {
  252. EMAC_HALF_DUPLEX = 0x00, /*!< half duplex */
  253. EMAC_FULL_DUPLEX = 0x01 /*!< full duplex */
  254. } emac_duplex_type;
  255. /**
  256. * @brief emac speed type
  257. */
  258. typedef enum
  259. {
  260. EMAC_SPEED_10MBPS = 0x00, /*!< 10 mbps */
  261. EMAC_SPEED_100MBPS = 0x01 /*!< 100 mbps */
  262. } emac_speed_type;
  263. /**
  264. * @brief emac interframe gap type
  265. */
  266. typedef enum
  267. {
  268. EMAC_INTERFRAME_GAP_96BIT = 0x00, /*!< 96-bit numbers between two frames */
  269. EMAC_INTERFRAME_GAP_88BIT = 0x01, /*!< 88-bit numbers between two frames */
  270. EMAC_INTERFRAME_GAP_80BIT = 0x02, /*!< 80-bit numbers between two frames */
  271. EMAC_INTERFRAME_GAP_72BIT = 0x03, /*!< 72-bit numbers between two frames */
  272. EMAC_INTERFRAME_GAP_64BIT = 0x04, /*!< 64-bit numbers between two frames */
  273. EMAC_INTERFRAME_GAP_56BIT = 0x05, /*!< 56-bit numbers between two frames */
  274. EMAC_INTERFRAME_GAP_48BIT = 0x06, /*!< 48-bit numbers between two frames */
  275. EMAC_INTERFRAME_GAP_40BIT = 0x07 /*!< 40-bit numbers between two frames */
  276. } emac_intergrame_gap_type;
  277. /**
  278. * @brief mdc clock range type
  279. */
  280. typedef enum
  281. {
  282. EMAC_CLOCK_RANGE_60_TO_100 = 0x00, /*!< mdc is hclk/42 */
  283. EMAC_CLOCK_RANGE_100_TO_150 = 0x01, /*!< mdc is hclk/62 */
  284. EMAC_CLOCK_RANGE_20_TO_35 = 0x02, /*!< mdc is hclk/16 */
  285. EMAC_CLOCK_RANGE_35_TO_60 = 0x03, /*!< mdc is hclk/26 */
  286. EMAC_CLOCK_RANGE_150_TO_240 = 0x04 /*!< mdc is hclk/102 */
  287. } emac_clock_range_type;
  288. /**
  289. * @brief emac control frames filter type
  290. */
  291. typedef enum
  292. {
  293. EMAC_CONTROL_FRAME_PASSING_NO = 0x00, /*!< don't pass any control frame to application */
  294. EMAC_CONTROL_FRAME_PASSING_ALL = 0x02, /*!< pass all control frames to application */
  295. EMAC_CONTROL_FRAME_PASSING_MATCH = 0x03 /*!< only pass filtered control frames to application */
  296. } emac_control_frames_filter_type;
  297. /**
  298. * @brief pause threshold type
  299. */
  300. typedef enum
  301. {
  302. EMAC_PAUSE_4_SLOT_TIME = 0x00, /*!< pause time is 4 slot time */
  303. EMAC_PAUSE_28_SLOT_TIME = 0x01, /*!< pause time is 28 slot time */
  304. EMAC_PAUSE_144_SLOT_TIME = 0x02, /*!< pause time is 144 slot time */
  305. EMAC_PAUSE_256_SLOT_TIME = 0x03 /*!< pause time is 256 slot time */
  306. } emac_pause_slot_threshold_type;
  307. /**
  308. * @brief interrupt mask type
  309. */
  310. typedef enum
  311. {
  312. EMAC_INTERRUPT_PMT_MASK = 0x00, /*!< mask pmt interrupt */
  313. EMAC_INTERRUPT_TST_MASK = 0x01 /*!< mask tst interrupt */
  314. } emac_interrupt_mask_type;
  315. /**
  316. * @brief mac address type
  317. */
  318. typedef enum
  319. {
  320. EMAC_ADDRESS_FILTER_1 = 0x01, /*!< mac address 1 filter */
  321. EMAC_ADDRESS_FILTER_2 = 0x02, /*!< mac address 2 filter */
  322. EMAC_ADDRESS_FILTER_3 = 0x03 /*!< mac address 3 filter */
  323. } emac_address_type;
  324. /**
  325. * @brief address filter type
  326. */
  327. typedef enum
  328. {
  329. EMAC_DESTINATION_FILTER = 0x00, /*!< destination mac address filter */
  330. EMAC_SOURCE_FILTER = 0x01 /*!< source mac address filter */
  331. } emac_address_filter_type;
  332. /**
  333. * @brief address mask type
  334. */
  335. typedef enum
  336. {
  337. EMAC_ADDRESS_MASK_8L0 = 0x01, /*!< byte 0 of mac address low register */
  338. EMAC_ADDRESS_MASK_15L8 = 0x02, /*!< byte 1 of mac address low register */
  339. EMAC_ADDRESS_MASK_23L16 = 0x04, /*!< byte 2 of mac address low register */
  340. EMAC_ADDRESS_MASK_31L24 = 0x08, /*!< byte 3 of mac address low register */
  341. EMAC_ADDRESS_MASK_7H0 = 0x10, /*!< byte 0 of mac address high register */
  342. EMAC_ADDRESS_MASK_15H8 = 0x20 /*!< byte 1 of mac address high register */
  343. } emac_address_mask_type;
  344. /**
  345. * @brief rx tx priority ratio type
  346. */
  347. typedef enum
  348. {
  349. EMAC_DMA_1_RX_1_TX = 0x00, /*!< rx/tx ratio is 1:1 */
  350. EMAC_DMA_2_RX_1_TX = 0x01, /*!< rx/tx ratio is 2:1 */
  351. EMAC_DMA_3_RX_1_TX = 0x02, /*!< rx/tx ratio is 3:1 */
  352. EMAC_DMA_4_RX_1_TX = 0x03 /*!< rx/tx ratio is 4:1 */
  353. } emac_dma_rx_tx_ratio_type;
  354. /**
  355. * @brief programmable burst length
  356. */
  357. typedef enum
  358. {
  359. EMAC_DMA_PBL_1 = 0x01, /*!< maximum 1 time of beats to be transferred in one dma transaction */
  360. EMAC_DMA_PBL_2 = 0x02, /*!< maximum 2 times of beats to be transferred in one dma transaction */
  361. EMAC_DMA_PBL_4 = 0x04, /*!< maximum 4 times of beats to be transferred in one dma transaction */
  362. EMAC_DMA_PBL_8 = 0x08, /*!< maximum 8 times of beats to be transferred in one dma transaction */
  363. EMAC_DMA_PBL_16 = 0x10, /*!< maximum 16 times of beats to be transferred in one dma transaction */
  364. EMAC_DMA_PBL_32 = 0x20 /*!< maximum 32 times of beats to be transferred in one dma transaction */
  365. } emac_dma_pbl_type;
  366. /**
  367. * @brief dma tx rx type
  368. */
  369. typedef enum
  370. {
  371. EMAC_DMA_TRANSMIT = 0x00, /*!< transmit dma */
  372. EMAC_DMA_RECEIVE = 0x01 /*!< receive dma */
  373. } emac_dma_tx_rx_type;
  374. /**
  375. * @brief dma receive process status type
  376. */
  377. typedef enum
  378. {
  379. EMAC_DMA_RX_RESET_STOP_COMMAND = 0x00, /*!< receive reset or stop command */
  380. EMAC_DMA_RX_FETCH_DESCRIPTOR = 0x01, /*!< rx dma is fetching descriptor */
  381. EMAC_DMA_RX_WAITING_PACKET = 0x03, /*!< rx dma is waiting for packets */
  382. EMAC_DMA_RX_DESCRIPTOR_UNAVAILABLE = 0x04, /*!< rx dma descriptor is unavailable */
  383. EMAC_DMA_RX_CLOSE_DESCRIPTOR = 0x05, /*!< rx dma is closing descriptor */
  384. EMAC_DMA_RX_FIFO_TO_HOST = 0x07 /*!< rx dma is transferring data from fifo to host */
  385. } emac_dma_receive_process_status_type;
  386. /**
  387. * @brief dma transmit process status type
  388. */
  389. typedef enum
  390. {
  391. EMAC_DMA_TX_RESET_STOP_COMMAND = 0x00, /*!< receive reset or stop command */
  392. EMAC_DMA_TX_FETCH_DESCRIPTOR = 0x01, /*!< tx dma is fetching descriptor */
  393. EMAC_DMA_TX_WAITING_FOR_STATUS = 0x02, /*!< tx dma is waiting for status message */
  394. EMAC_DMA_TX_HOST_TO_FIFO = 0x03, /*!< tx dma is reading data from host and forward data to fifo */
  395. EMAC_DMA_TX_DESCRIPTOR_UNAVAILABLE = 0x06, /*!< tx dma is unavailable or fifo underflow */
  396. EMAC_DMA_TX_CLOSE_DESCRIPTOR = 0x07 /*!< tx dma is closing descriptor */
  397. } emac_dma_transmit_process_status_type;
  398. /**
  399. * @brief dma operations type
  400. */
  401. typedef enum
  402. {
  403. EMAC_DMA_OPS_START_STOP_RECEIVE = 0x00, /*!< start/stop receive */
  404. EMAC_DMA_OPS_SECOND_FRAME = 0x01, /*!< operate on second frame */
  405. EMAC_DMA_OPS_FORWARD_UNDERSIZED = 0x02, /*!< forward undersized good frames*/
  406. EMAC_DMA_OPS_FORWARD_ERROR = 0x03, /*!< forward error frames */
  407. EMAC_DMA_OPS_START_STOP_TRANSMIT = 0x04, /*!< start/stop transmission */
  408. EMAC_DMA_OPS_FLUSH_TRANSMIT_FIFO = 0x05, /*!< flush transmit fifo */
  409. EMAC_DMA_OPS_TRANSMIT_STORE_FORWARD = 0x06, /*!< transmit store and forward */
  410. EMAC_DMA_OPS_RECEIVE_FLUSH_DISABLE = 0x07, /*!< disable flushing of received frames */
  411. EMAC_DMA_OPS_RECEIVE_STORE_FORWARD = 0x08, /*!< receive store and forward */
  412. EMAC_DMA_OPS_DROP_ERROR_DISABLE = 0x09 /*!< disbale dropping of tcp/ip checksum error frames */
  413. } emac_dma_operations_type;
  414. /**
  415. * @brief receive threshold control type
  416. */
  417. typedef enum
  418. {
  419. EMAC_DMA_RX_THRESHOLD_64_BYTES = 0x00, /*!< receive starts when the frame size within the receiv fifo is larger than 64 bytes */
  420. EMAC_DMA_RX_THRESHOLD_32_BYTES = 0x01, /*!< receive starts when the frame size within the receiv fifo is larger than 32 bytes */
  421. EMAC_DMA_RX_THRESHOLD_96_BYTES = 0x02, /*!< receive starts when the frame size within the receiv fifo is larger than 96 bytes */
  422. EMAC_DMA_RX_THRESHOLD_128_BYTES = 0x03 /*!< receive starts when the frame size within the receiv fifo is larger than 128 bytes */
  423. } emac_dma_receive_threshold_type;
  424. /**
  425. * @brief transmit threshold control type
  426. */
  427. typedef enum
  428. {
  429. EMAC_DMA_TX_THRESHOLD_64_BYTES = 0x00, /*!< transmission starts when the frame size within the transmit FIFO is larger than 64 bytes */
  430. EMAC_DMA_TX_THRESHOLD_128_BYTES = 0x01, /*!< transmission starts when the frame size within the transmit FIFO is larger than 128 bytes */
  431. EMAC_DMA_TX_THRESHOLD_192_BYTES = 0x02, /*!< transmission starts when the frame size within the transmit FIFO is larger than 192 bytes */
  432. EMAC_DMA_TX_THRESHOLD_256_BYTES = 0x03, /*!< transmission starts when the frame size within the transmit FIFO is larger than 256 bytes */
  433. EMAC_DMA_TX_THRESHOLD_40_BYTES = 0x04, /*!< transmission starts when the frame size within the transmit FIFO is larger than 40 bytes */
  434. EMAC_DMA_TX_THRESHOLD_32_BYTES = 0x05, /*!< transmission starts when the frame size within the transmit FIFO is larger than 32 bytes */
  435. EMAC_DMA_TX_THRESHOLD_24_BYTES = 0x06, /*!< transmission starts when the frame size within the transmit FIFO is larger than 24 bytes */
  436. EMAC_DMA_TX_THRESHOLD_16_BYTES = 0x07 /*!< transmission starts when the frame size within the transmit FIFO is larger than 16 bytes */
  437. } emac_dma_transmit_threshold_type;
  438. /**
  439. * @brief dma interrupt type
  440. */
  441. typedef enum
  442. {
  443. EMAC_DMA_INTERRUPT_TX = 0x00, /*!< transmit interrupt */
  444. EMAC_DMA_INTERRUPT_TX_STOP = 0x01, /*!< transmit process stopped interrupt */
  445. EMAC_DMA_INTERRUPT_TX_UNAVAILABLE = 0x02, /*!< transmit buffer unavailable interrupt */
  446. EMAC_DMA_INTERRUPT_TX_JABBER = 0x03, /*!< transmit jabber timeout interrupt */
  447. EMAC_DMA_INTERRUPT_RX_OVERFLOW = 0x04, /*!< receive overflow interrupt */
  448. EMAC_DMA_INTERRUPT_TX_UNDERFLOW = 0x05, /*!< transmit underflow interrupt */
  449. EMAC_DMA_INTERRUPT_RX = 0x06, /*!< receive interrupt */
  450. EMAC_DMA_INTERRUPT_RX_UNAVAILABLE = 0x07, /*!< receive buffer unavailable interrupt */
  451. EMAC_DMA_INTERRUPT_RX_STOP = 0x08, /*!< receive process stopped interrupt */
  452. EMAC_DMA_INTERRUPT_RX_TIMEOUT = 0x09, /*!< receive watchdog timeout interrupt */
  453. EMAC_DMA_INTERRUPT_TX_EARLY = 0x0A, /*!< early transmit interrupt */
  454. EMAC_DMA_INTERRUPT_FATAL_BUS_ERROR = 0x0B, /*!< fatal bus error interrupt */
  455. EMAC_DMA_INTERRUPT_RX_EARLY = 0x0C, /*!< early receive interrupt */
  456. EMAC_DMA_INTERRUPT_ABNORMAL_SUMMARY = 0x0D, /*!< abnormal interrupt summary */
  457. EMAC_DMA_INTERRUPT_NORMAL_SUMMARY = 0x0E /*!< normal interrupt summary */
  458. } emac_dma_interrupt_type;
  459. /**
  460. * @brief dma tansfer address type
  461. */
  462. typedef enum
  463. {
  464. EMAC_DMA_TX_DESCRIPTOR = 0x00, /*!< transmit descriptor address */
  465. EMAC_DMA_RX_DESCRIPTOR = 0x01, /*!< receive descriptor address */
  466. EMAC_DMA_TX_BUFFER = 0x02, /*!< transmit buffer address */
  467. EMAC_DMA_RX_BUFFER = 0x03 /*!< receive buffer address */
  468. } emac_dma_transfer_address_type;
  469. /**
  470. * @brief clock node type
  471. */
  472. typedef enum
  473. {
  474. EMAC_PTP_NORMAL_CLOCK = 0x00, /*!< normal clock node */
  475. EMAC_PTP_BOUNDARY_CLOCK = 0x01, /*!< boundary clock node */
  476. EMAC_PTP_END_TO_END_CLOCK = 0x02, /*!< end to end transparent clock node */
  477. EMAC_PTP_PEER_TO_PEER_CLOCK = 0x03 /*!< peer to peer transparent clock node */
  478. } emac_ptp_clock_node_type;
  479. /**
  480. * @brief time stamp status type
  481. */
  482. typedef enum
  483. {
  484. EMAC_PTP_SECOND_OVERFLOW = 0x00, /*!< time stamp second overflow */
  485. EMAC_PTP_TARGET_TIME_REACH = 0x01 /*!< time stamp target time reached */
  486. } emac_ptp_timestamp_status_type;
  487. /**
  488. * @brief pps control type
  489. */
  490. typedef enum
  491. {
  492. EMAC_PTP_PPS_1HZ = 0x00, /*!< pps frequency is 1 hz */
  493. EMAC_PTP_PPS_2HZ = 0x01, /*!< pps frequency is 2 hz */
  494. EMAC_PTP_PPS_4HZ = 0x02, /*!< pps frequency is 4 hz */
  495. EMAC_PTP_PPS_8HZ = 0x03, /*!< pps frequency is 8 hz */
  496. EMAC_PTP_PPS_16HZ = 0x04, /*!< pps frequency is 16 hz */
  497. EMAC_PTP_PPS_32HZ = 0x05, /*!< pps frequency is 32 hz */
  498. EMAC_PTP_PPS_64HZ = 0x06, /*!< pps frequency is 64 hz */
  499. EMAC_PTP_PPS_128HZ = 0x07, /*!< pps frequency is 128 hz */
  500. EMAC_PTP_PPS_256HZ = 0x08, /*!< pps frequency is 256 hz */
  501. EMAC_PTP_PPS_512HZ = 0x09, /*!< pps frequency is 512 hz */
  502. EMAC_PTP_PPS_1024HZ = 0x0A, /*!< pps frequency is 1024 hz */
  503. EMAC_PTP_PPS_2048HZ = 0x0B, /*!< pps frequency is 2048 hz */
  504. EMAC_PTP_PPS_4096HZ = 0x0C, /*!< pps frequency is 4096 hz */
  505. EMAC_PTP_PPS_8192HZ = 0x0D, /*!< pps frequency is 8192 hz */
  506. EMAC_PTP_PPS_16384HZ = 0x0E, /*!< pps frequency is 16384 hz */
  507. EMAC_PTP_PPS_32768HZ = 0x0F /*!< pps frequency is 32768 hz */
  508. } emac_ptp_pps_control_type;
  509. /**
  510. * @brief ethernet mac control config type
  511. */
  512. typedef struct
  513. {
  514. emac_auto_negotiation_type auto_nego; /*!< auto negotiatin enable */
  515. confirm_state deferral_check; /*!< deferral check enable */
  516. emac_bol_type back_off_limit; /*!< back-off limit setting */
  517. confirm_state auto_pad_crc_strip; /*!< automtic pad/crc stripping enable */
  518. confirm_state retry_disable; /*!< retry disable*/
  519. confirm_state ipv4_checksum_offload; /*!< ipv4 checksum offload enable */
  520. emac_duplex_type duplex_mode; /*!< duplex mode enable */
  521. confirm_state loopback_mode; /*!< loopback mode enable */
  522. confirm_state receive_own_disable; /*!< receive own disbale */
  523. emac_speed_type fast_ethernet_speed; /*!< fast ethernet speed enable */
  524. confirm_state carrier_sense_disable; /*!< carrier sense disable*/
  525. emac_intergrame_gap_type interframe_gap; /*!< set interframe gap */
  526. confirm_state jabber_disable; /*!< jabber disbale */
  527. confirm_state watchdog_disable; /*!< watchdog disable */
  528. } emac_control_config_type;
  529. /**
  530. * @brief ethernet mac dma config type
  531. */
  532. typedef struct
  533. {
  534. confirm_state aab_enable; /*!< address-aligned beats enable */
  535. confirm_state usp_enable; /*!< separate PBL enable */
  536. emac_dma_pbl_type rx_dma_pal; /*!< rx dma pbl */
  537. confirm_state fb_enable; /*!< separate PBL enable */
  538. emac_dma_pbl_type tx_dma_pal; /*!< tx dma pbl */
  539. uint8_t desc_skip_length; /*!< descriptor skip length */
  540. confirm_state da_enable; /*!< dma arbitration enable */
  541. emac_dma_rx_tx_ratio_type priority_ratio; /*!< priority ratio */
  542. confirm_state dt_disable; /*!< disable dropping of tcp/ip checksum error frames */
  543. confirm_state rsf_enable; /*!< enable receiving store or forward */
  544. confirm_state flush_rx_disable; /*!< disable flushing of received frames */
  545. confirm_state tsf_enable; /*!< enable transmitting store or forward */
  546. emac_dma_transmit_threshold_type tx_threshold; /*!< transmit threshold control */
  547. confirm_state fef_enable; /*!< enable forward error frames */
  548. confirm_state fugf_enable; /*!< enable forward undersized good frames */
  549. emac_dma_receive_threshold_type rx_threshold; /*!< receive threshold control */
  550. confirm_state osf_enable; /*!< enable operating on second frames */
  551. } emac_dma_config_type;
  552. /**
  553. * @brief dma desciptors data structure definition
  554. */
  555. typedef struct {
  556. uint32_t status; /*!< status */
  557. uint32_t controlsize; /*!< control and buffer1, buffer2 lengths */
  558. uint32_t buf1addr; /*!< buffer1 address pointer */
  559. uint32_t buf2nextdescaddr; /*!< buffer2 or next descriptor address pointer */
  560. } emac_dma_desc_type;
  561. /**
  562. * @brief type define emac mac register all
  563. */
  564. typedef struct
  565. {
  566. /**
  567. * @brief emac mac ctrl register, offset:0x00
  568. */
  569. union
  570. {
  571. __IO uint32_t ctrl;
  572. struct
  573. {
  574. __IO uint32_t reserved1 : 2; /* [0:1] */
  575. __IO uint32_t re : 1; /* [2] */
  576. __IO uint32_t te : 1; /* [3] */
  577. __IO uint32_t dc : 1; /* [4] */
  578. __IO uint32_t bl : 2; /* [5:6] */
  579. __IO uint32_t acs : 1; /* [7] */
  580. __IO uint32_t reserved2 : 1; /* [8] */
  581. __IO uint32_t dr : 1; /* [9] */
  582. __IO uint32_t ipc : 1; /* [10] */
  583. __IO uint32_t dm : 1; /* [11] */
  584. __IO uint32_t lm : 1; /* [12] */
  585. __IO uint32_t dro : 1; /* [13] */
  586. __IO uint32_t fes : 1; /* [14] */
  587. __IO uint32_t reserved3 : 1; /* [15] */
  588. __IO uint32_t dcs : 1; /* [16] */
  589. __IO uint32_t ifg : 3; /* [17:19] */
  590. __IO uint32_t reserved4 : 2; /* [20:21] */
  591. __IO uint32_t jd : 1; /* [22] */
  592. __IO uint32_t wd : 1; /* [23] */
  593. __IO uint32_t reserved5 : 8; /* [24:31] */
  594. } ctrl_bit;
  595. };
  596. /**
  597. * @brief emac mac frmf register, offset:0x04
  598. */
  599. union
  600. {
  601. __IO uint32_t frmf;
  602. struct
  603. {
  604. __IO uint32_t pr : 1; /* [0] */
  605. __IO uint32_t huc : 1; /* [1] */
  606. __IO uint32_t hmc : 1; /* [2] */
  607. __IO uint32_t daif : 1; /* [3] */
  608. __IO uint32_t pmc : 1; /* [4] */
  609. __IO uint32_t dbf : 1; /* [5] */
  610. __IO uint32_t pcf : 2; /* [6:7] */
  611. __IO uint32_t saif : 1; /* [8] */
  612. __IO uint32_t saf : 1; /* [9] */
  613. __IO uint32_t hpf : 1; /* [10] */
  614. __IO uint32_t reserved1 : 20;/* [11:30] */
  615. __IO uint32_t ra : 1; /* [31] */
  616. } frmf_bit;
  617. };
  618. /**
  619. * @brief emac mac hth register, offset:0x08
  620. */
  621. union
  622. {
  623. __IO uint32_t hth;
  624. struct
  625. {
  626. __IO uint32_t hth : 32; /* [0:31] */
  627. } hth_bit;
  628. };
  629. /**
  630. * @brief emac mac htl register, offset:0x0c
  631. */
  632. union
  633. {
  634. __IO uint32_t htl;
  635. struct
  636. {
  637. __IO uint32_t htl : 32; /* [0:31] */
  638. } htl_bit;
  639. };
  640. /**
  641. * @brief emac mac miiaddr register, offset:0x10
  642. */
  643. union
  644. {
  645. __IO uint32_t miiaddr;
  646. struct
  647. {
  648. __IO uint32_t mb : 1; /* [0] */
  649. __IO uint32_t mw : 1; /* [1] */
  650. __IO uint32_t cr : 4; /* [2:5] */
  651. __IO uint32_t mii : 5; /* [6:10] */
  652. __IO uint32_t pa : 5; /* [11:15] */
  653. __IO uint32_t reserved1 : 16;/* [16:31] */
  654. } miiaddr_bit;
  655. };
  656. /**
  657. * @brief emac mac miidt register, offset:0x14
  658. */
  659. union
  660. {
  661. __IO uint32_t miidt;
  662. struct
  663. {
  664. __IO uint32_t md : 16;/* [0:15] */
  665. __IO uint32_t reserved1 : 16;/* [16:31] */
  666. } miidt_bit;
  667. };
  668. /**
  669. * @brief emac mac fctrl register, offset:0x18
  670. */
  671. union
  672. {
  673. __IO uint32_t fctrl;
  674. struct
  675. {
  676. __IO uint32_t fcbbpa : 1; /* [0] */
  677. __IO uint32_t etf : 1; /* [1] */
  678. __IO uint32_t erf : 1; /* [2] */
  679. __IO uint32_t dup : 1; /* [3] */
  680. __IO uint32_t plt : 2; /* [4:5] */
  681. __IO uint32_t reserved1 : 1; /* [6] */
  682. __IO uint32_t dzqp : 1; /* [7] */
  683. __IO uint32_t reserved2 : 8; /* [8:15] */
  684. __IO uint32_t pt : 16;/* [16:31] */
  685. } fctrl_bit;
  686. };
  687. /**
  688. * @brief emac mac vlt register, offset:0x1C
  689. */
  690. union
  691. {
  692. __IO uint32_t vlt;
  693. struct
  694. {
  695. __IO uint32_t vti : 16;/* [0:15] */
  696. __IO uint32_t etv : 1; /* [16] */
  697. __IO uint32_t reserved1 : 15;/* [17:31] */
  698. } vlt_bit;
  699. };
  700. /**
  701. * @brief emac mac reserved1 register, offset:0x20~0x24
  702. */
  703. __IO uint32_t reserved1[2];
  704. /**
  705. * @brief emac mac rwff register, offset:0x28
  706. */
  707. __IO uint32_t rwff;
  708. /**
  709. * @brief emac mac pmtctrlsts register, offset:0x2C
  710. */
  711. union
  712. {
  713. __IO uint32_t pmtctrlsts;
  714. struct
  715. {
  716. __IO uint32_t pd : 1; /* [0] */
  717. __IO uint32_t emp : 1; /* [1] */
  718. __IO uint32_t erwf : 1; /* [2] */
  719. __IO uint32_t reserved1 : 2; /* [3:4] */
  720. __IO uint32_t rmp : 1; /* [5] */
  721. __IO uint32_t rrwf : 1; /* [6] */
  722. __IO uint32_t reserved2 : 2; /* [7:8] */
  723. __IO uint32_t guc : 1; /* [9] */
  724. __IO uint32_t reserved3 : 21;/* [10:30] */
  725. __IO uint32_t rwffpr : 1; /* [31] */
  726. } pmtctrlsts_bit;
  727. };
  728. /**
  729. * @brief emac mac reserved2 register, offset:0x30~0x34
  730. */
  731. __IO uint32_t reserved2[2];
  732. /**
  733. * @brief emac mac ists register, offset:0x38
  734. */
  735. union
  736. {
  737. __IO uint32_t ists;
  738. struct
  739. {
  740. __IO uint32_t reserved1 : 3; /* [0:2] */
  741. __IO uint32_t pis : 1; /* [3] */
  742. __IO uint32_t mis : 1; /* [4] */
  743. __IO uint32_t mris : 1; /* [5] */
  744. __IO uint32_t mtis : 1; /* [6] */
  745. __IO uint32_t reserved2 : 2; /* [7:8] */
  746. __IO uint32_t tis : 1; /* [9] */
  747. __IO uint32_t reserved3 : 22;/* [10:31] */
  748. } ists_bit;
  749. };
  750. /**
  751. * @brief emac mac imr register, offset:0x3C
  752. */
  753. union
  754. {
  755. __IO uint32_t imr;
  756. struct
  757. {
  758. __IO uint32_t reserved1 : 3; /* [0:2] */
  759. __IO uint32_t pim : 1; /* [3] */
  760. __IO uint32_t reserved2 : 5; /* [4:8] */
  761. __IO uint32_t tim : 1; /* [9] */
  762. __IO uint32_t reserved3 : 22;/* [10:31] */
  763. } imr_bit;
  764. };
  765. /**
  766. * @brief emac mac a0h register, offset:0x40
  767. */
  768. union
  769. {
  770. __IO uint32_t a0h;
  771. struct
  772. {
  773. __IO uint32_t ma0h : 16;/* [0:15] */
  774. __IO uint32_t reserved1 : 15;/* [16:30] */
  775. __IO uint32_t ae : 1; /* [31] */
  776. } a0h_bit;
  777. };
  778. /**
  779. * @brief emac mac a0l register, offset:0x44
  780. */
  781. union
  782. {
  783. __IO uint32_t a0l;
  784. struct
  785. {
  786. __IO uint32_t ma0l : 32;/* [0:31] */
  787. } a0l_bit;
  788. };
  789. /**
  790. * @brief emac mac a1h register, offset:0x48
  791. */
  792. union
  793. {
  794. __IO uint32_t a1h;
  795. struct
  796. {
  797. __IO uint32_t ma1h : 16;/* [0:15] */
  798. __IO uint32_t reserved1 : 8; /* [16:23] */
  799. __IO uint32_t mbc : 6; /* [24:29] */
  800. __IO uint32_t sa : 1; /* [30] */
  801. __IO uint32_t ae : 1; /* [31] */
  802. } a1h_bit;
  803. };
  804. /**
  805. * @brief emac mac a1l register, offset:0x4C
  806. */
  807. union
  808. {
  809. __IO uint32_t a1l;
  810. struct
  811. {
  812. __IO uint32_t ma1l : 32;/* [0:31] */
  813. } a1l_bit;
  814. };
  815. /**
  816. * @brief emac mac a2h register, offset:0x50
  817. */
  818. union
  819. {
  820. __IO uint32_t a2h;
  821. struct
  822. {
  823. __IO uint32_t ma2h : 16;/* [0:15] */
  824. __IO uint32_t reserved1 : 8; /* [16:23] */
  825. __IO uint32_t mbc : 6; /* [24:29] */
  826. __IO uint32_t sa : 1; /* [30] */
  827. __IO uint32_t ae : 1; /* [31] */
  828. } a2h_bit;
  829. };
  830. /**
  831. * @brief emac mac a2l register, offset:0x54
  832. */
  833. union
  834. {
  835. __IO uint32_t a2l;
  836. struct
  837. {
  838. __IO uint32_t ma2l : 32;/* [0:31] */
  839. } a2l_bit;
  840. };
  841. /**
  842. * @brief emac mac a3h register, offset:0x58
  843. */
  844. union
  845. {
  846. __IO uint32_t a3h;
  847. struct
  848. {
  849. __IO uint32_t ma3h : 16;/* [0:15] */
  850. __IO uint32_t reserved1 : 8; /* [16:23] */
  851. __IO uint32_t mbc : 6; /* [24:29] */
  852. __IO uint32_t sa : 1; /* [30] */
  853. __IO uint32_t ae : 1; /* [31] */
  854. } a3h_bit;
  855. };
  856. /**
  857. * @brief emac mac a3l register, offset:0x5C
  858. */
  859. union
  860. {
  861. __IO uint32_t a3l;
  862. struct
  863. {
  864. __IO uint32_t ma3l : 32;/* [0:31] */
  865. } a3l_bit;
  866. };
  867. } emac_type;
  868. /**
  869. * @brief type define emac mmc register all
  870. */
  871. typedef struct
  872. {
  873. /**
  874. * @brief emac mmc ctrl register, offset:0x0100
  875. */
  876. union
  877. {
  878. __IO uint32_t ctrl;
  879. struct
  880. {
  881. __IO uint32_t rc : 1; /* [0] */
  882. __IO uint32_t scr : 1; /* [1] */
  883. __IO uint32_t rr : 1; /* [2] */
  884. __IO uint32_t fmc : 1; /* [3] */
  885. __IO uint32_t reserved1 : 28;/* [4:31] */
  886. } ctrl_bit;
  887. };
  888. /**
  889. * @brief emac mmc ri register, offset:0x0104
  890. */
  891. union
  892. {
  893. __IO uint32_t ri;
  894. struct
  895. {
  896. __IO uint32_t reserved1 : 5; /* [0:4] */
  897. __IO uint32_t rfce : 1; /* [5] */
  898. __IO uint32_t rfae : 1; /* [6] */
  899. __IO uint32_t reserved2 : 10;/* [7:16] */
  900. __IO uint32_t rguf : 1; /* [17] */
  901. __IO uint32_t reserved3 : 14;/* [18:31] */
  902. } ri_bit;
  903. };
  904. /**
  905. * @brief emac mmc ti register, offset:0x0108
  906. */
  907. union
  908. {
  909. __IO uint32_t ti;
  910. struct
  911. {
  912. __IO uint32_t reserved1 : 14;/* [0:13] */
  913. __IO uint32_t tscgfci : 1; /* [14] */
  914. __IO uint32_t tgfmsc : 1; /* [15] */
  915. __IO uint32_t reserved2 : 5; /* [16:20] */
  916. __IO uint32_t tgf : 1; /* [21] */
  917. __IO uint32_t reserved3 : 10;/* [22:31] */
  918. } ti_bit;
  919. };
  920. /**
  921. * @brief emac mmc rim register, offset:0x010C
  922. */
  923. union
  924. {
  925. __IO uint32_t rim;
  926. struct
  927. {
  928. __IO uint32_t reserved1 : 5; /* [0:4] */
  929. __IO uint32_t rcefcim : 1; /* [5] */
  930. __IO uint32_t raefacim : 1; /* [6] */
  931. __IO uint32_t reserved2 : 10;/* [7:16] */
  932. __IO uint32_t rugfcim : 1; /* [17] */
  933. __IO uint32_t reserved3 : 14;/* [18:31] */
  934. } rim_bit;
  935. };
  936. /**
  937. * @brief emac mmc tim register, offset:0x0110
  938. */
  939. union
  940. {
  941. __IO uint32_t tim;
  942. struct
  943. {
  944. __IO uint32_t reserved1 : 14;/* [0:13] */
  945. __IO uint32_t tscgfcim : 1; /* [14] */
  946. __IO uint32_t tmcgfcim : 1; /* [15] */
  947. __IO uint32_t reserved2 : 5; /* [16:20] */
  948. __IO uint32_t tgfcim : 1; /* [21] */
  949. __IO uint32_t reserved3 : 10;/* [22:31] */
  950. } tim_bit;
  951. };
  952. /**
  953. * @brief emac mmc reserved1 register, offset:0x0114~0x0148
  954. */
  955. __IO uint32_t reserved1[14];
  956. /**
  957. * @brief emac mmc tfscc register, offset:0x014C
  958. */
  959. union
  960. {
  961. __IO uint32_t tfscc;
  962. struct
  963. {
  964. __IO uint32_t tgfscc : 32;/* [0:31] */
  965. } tfscc_bit;
  966. };
  967. /**
  968. * @brief emac mmc tfmscc register, offset:0x0150
  969. */
  970. union
  971. {
  972. __IO uint32_t tfmscc;
  973. struct
  974. {
  975. __IO uint32_t tgfmscc : 32;/* [0:31] */
  976. } tfmscc_bit;
  977. };
  978. /**
  979. * @brief emac mmc reserved2 register, offset:0x0154~0x0164
  980. */
  981. __IO uint32_t reserved2[5];
  982. /**
  983. * @brief emac mmc tfcnt register, offset:0x0168
  984. */
  985. union
  986. {
  987. __IO uint32_t tfcnt;
  988. struct
  989. {
  990. __IO uint32_t tgfc : 32;/* [0:31] */
  991. } tfcnt_bit;
  992. };
  993. /**
  994. * @brief emac mmc reserved3 register, offset:0x016C~0x0190
  995. */
  996. __IO uint32_t reserved3[10];
  997. /**
  998. * @brief emac mmc rfcecnt register, offset:0x0194
  999. */
  1000. union
  1001. {
  1002. __IO uint32_t rfcecnt;
  1003. struct
  1004. {
  1005. __IO uint32_t rfcec : 32;/* [0:31] */
  1006. } rfcecnt_bit;
  1007. };
  1008. /**
  1009. * @brief emac mmc rfaecnt register, offset:0x0198
  1010. */
  1011. union
  1012. {
  1013. __IO uint32_t rfaecnt;
  1014. struct
  1015. {
  1016. __IO uint32_t rfaec : 32;/* [0:31] */
  1017. } rfaecnt_bit;
  1018. };
  1019. /**
  1020. * @brief emac mmc reserved4 register, offset:0x019C~0x01C0
  1021. */
  1022. __IO uint32_t reserved4[10];
  1023. /**
  1024. * @brief emac mmc rgufcnt register, offset:0x01C4
  1025. */
  1026. union
  1027. {
  1028. __IO uint32_t rgufcnt;
  1029. struct
  1030. {
  1031. __IO uint32_t rgufc : 32;/* [0:31] */
  1032. } rgufcnt_bit;
  1033. };
  1034. } emac_mmc_type;
  1035. /**
  1036. * @brief type define emac ptp register all
  1037. */
  1038. typedef struct
  1039. {
  1040. /**
  1041. * @brief emac ptp tsctrl register, offset:0x0700
  1042. */
  1043. union
  1044. {
  1045. __IO uint32_t tsctrl;
  1046. struct
  1047. {
  1048. __IO uint32_t te : 1; /* [0] */
  1049. __IO uint32_t tfcu : 1; /* [1] */
  1050. __IO uint32_t ti : 1; /* [2] */
  1051. __IO uint32_t tu : 1; /* [3] */
  1052. __IO uint32_t tite : 1; /* [4] */
  1053. __IO uint32_t aru : 1; /* [5] */
  1054. __IO uint32_t reserved1 : 2; /* [6:7] */
  1055. __IO uint32_t etaf : 1; /* [8] */
  1056. __IO uint32_t tdbrc : 1; /* [9] */
  1057. __IO uint32_t eppv2f : 1; /* [10] */
  1058. __IO uint32_t eppef : 1; /* [11] */
  1059. __IO uint32_t eppfsip6u : 1; /* [12] */
  1060. __IO uint32_t eppfsip4u : 1; /* [13] */
  1061. __IO uint32_t etsfem : 1; /* [14] */
  1062. __IO uint32_t esfmrtm : 1; /* [15] */
  1063. __IO uint32_t sppfts : 2; /* [16:17] */
  1064. __IO uint32_t emafpff : 1; /* [18] */
  1065. __IO uint32_t reserved2 : 13;/* [19:31] */
  1066. } tsctrl_bit;
  1067. };
  1068. /**
  1069. * @brief emac ptp ssinc register, offset:0x0704
  1070. */
  1071. union
  1072. {
  1073. __IO uint32_t ssinc;
  1074. struct
  1075. {
  1076. __IO uint32_t ssiv : 8; /* [0] */
  1077. __IO uint32_t reserved1 : 24;/* [8:31] */
  1078. } ssinc_bit;
  1079. };
  1080. /**
  1081. * @brief emac ptp tsh register, offset:0x0708
  1082. */
  1083. union
  1084. {
  1085. __IO uint32_t tsh;
  1086. struct
  1087. {
  1088. __IO uint32_t ts : 32;/* [0:31] */
  1089. } tsh_bit;
  1090. };
  1091. /**
  1092. * @brief emac ptp tsl register, offset:0x070C
  1093. */
  1094. union
  1095. {
  1096. __IO uint32_t tsl;
  1097. struct
  1098. {
  1099. __IO uint32_t tss : 31;/* [0:30] */
  1100. __IO uint32_t ast : 1; /* [31] */
  1101. } tsl_bit;
  1102. };
  1103. /**
  1104. * @brief emac ptp tshud register, offset:0x0710
  1105. */
  1106. union
  1107. {
  1108. __IO uint32_t tshud;
  1109. struct
  1110. {
  1111. __IO uint32_t ts : 32;/* [0:31] */
  1112. } tshud_bit;
  1113. };
  1114. /**
  1115. * @brief emac ptp tslud register, offset:0x0714
  1116. */
  1117. union
  1118. {
  1119. __IO uint32_t tslud;
  1120. struct
  1121. {
  1122. __IO uint32_t tss : 31;/* [0:30] */
  1123. __IO uint32_t ast : 1; /* [31] */
  1124. } tslud_bit;
  1125. };
  1126. /**
  1127. * @brief emac ptp tsad register, offset:0x0718
  1128. */
  1129. union
  1130. {
  1131. __IO uint32_t tsad;
  1132. struct
  1133. {
  1134. __IO uint32_t tar : 32;/* [0:31] */
  1135. } tsad_bit;
  1136. };
  1137. /**
  1138. * @brief emac ptp tth register, offset:0x071C
  1139. */
  1140. union
  1141. {
  1142. __IO uint32_t tth;
  1143. struct
  1144. {
  1145. __IO uint32_t ttsr : 32;/* [0:31] */
  1146. } tth_bit;
  1147. };
  1148. /**
  1149. * @brief emac ptp ttl register, offset:0x0720
  1150. */
  1151. union
  1152. {
  1153. __IO uint32_t ttl;
  1154. struct
  1155. {
  1156. __IO uint32_t ttlr : 32;/* [0:31] */
  1157. } ttl_bit;
  1158. };
  1159. /**
  1160. * @brief emac ptp reserved register, offset:0x0724
  1161. */
  1162. __IO uint32_t reserved1;
  1163. /**
  1164. * @brief emac ptp tssr register, offset:0x0728
  1165. */
  1166. union
  1167. {
  1168. __IO uint32_t tssr;
  1169. struct
  1170. {
  1171. __IO uint32_t tso : 1; /* [0] */
  1172. __IO uint32_t tttr : 1; /* [1] */
  1173. __IO uint32_t reserved1 : 30;/* [2:31] */
  1174. } tssr_bit;
  1175. };
  1176. /**
  1177. * @brief emac ptp ppscr register, offset:0x072C
  1178. */
  1179. union
  1180. {
  1181. __IO uint32_t ppscr;
  1182. struct
  1183. {
  1184. __IO uint32_t pofc : 4; /* [0:3] */
  1185. __IO uint32_t reserved1 : 28;/* [4:31] */
  1186. } ppscr_bit;
  1187. };
  1188. } emac_ptp_type;
  1189. /**
  1190. * @brief type define emac ptp register all
  1191. */
  1192. typedef struct
  1193. {
  1194. /**
  1195. * @brief emac dma bm register, offset:0x1000
  1196. */
  1197. union
  1198. {
  1199. __IO uint32_t bm;
  1200. struct
  1201. {
  1202. __IO uint32_t swr : 1; /* [0] */
  1203. __IO uint32_t da : 1; /* [1] */
  1204. __IO uint32_t dsl : 5; /* [2:6] */
  1205. __IO uint32_t reserved1 : 1; /* [7] */
  1206. __IO uint32_t pbl : 6; /* [8:13] */
  1207. __IO uint32_t pr : 2; /* [14:15] */
  1208. __IO uint32_t fb : 1; /* [16] */
  1209. __IO uint32_t rdp : 6; /* [17:22] */
  1210. __IO uint32_t usp : 1; /* [23] */
  1211. __IO uint32_t pblx8 : 1; /* [24] */
  1212. __IO uint32_t aab : 1; /* [25] */
  1213. __IO uint32_t reserved2 : 6; /* [26:31] */
  1214. } bm_bit;
  1215. };
  1216. /**
  1217. * @brief emac dma tpd register, offset:0x1004
  1218. */
  1219. union
  1220. {
  1221. __IO uint32_t tpd;
  1222. struct
  1223. {
  1224. __IO uint32_t tpd : 32; /* [0:31] */
  1225. } tpd_bit;
  1226. };
  1227. /**
  1228. * @brief emac dma rpd register, offset:0x1008
  1229. */
  1230. union
  1231. {
  1232. __IO uint32_t rpd;
  1233. struct
  1234. {
  1235. __IO uint32_t rpd : 32; /* [0:31] */
  1236. } rpd_bit;
  1237. };
  1238. /**
  1239. * @brief emac dma rdladdr register, offset:0x100c
  1240. */
  1241. union
  1242. {
  1243. __IO uint32_t rdladdr;
  1244. struct
  1245. {
  1246. __IO uint32_t srl : 32; /* [0:31] */
  1247. } rdladdr_bit;
  1248. };
  1249. /**
  1250. * @brief emac dma tdladdr register, offset:0x1010
  1251. */
  1252. union
  1253. {
  1254. __IO uint32_t tdladdr;
  1255. struct
  1256. {
  1257. __IO uint32_t stl : 32; /* [0:31] */
  1258. } tdladdr_bit;
  1259. };
  1260. /**
  1261. * @brief emac dma sts register, offset:0x1014
  1262. */
  1263. union
  1264. {
  1265. __IO uint32_t sts;
  1266. struct
  1267. {
  1268. __IO uint32_t ti : 1; /* [0] */
  1269. __IO uint32_t tps : 1; /* [1] */
  1270. __IO uint32_t tbu : 1; /* [2] */
  1271. __IO uint32_t tjt : 1; /* [3] */
  1272. __IO uint32_t ovf : 1; /* [4] */
  1273. __IO uint32_t unf : 1; /* [5] */
  1274. __IO uint32_t ri : 1; /* [6] */
  1275. __IO uint32_t rbu : 1; /* [7] */
  1276. __IO uint32_t rps : 1; /* [8] */
  1277. __IO uint32_t rwt : 1; /* [9] */
  1278. __IO uint32_t eti : 1; /* [10] */
  1279. __IO uint32_t reserved1 : 2; /* [11:12] */
  1280. __IO uint32_t fbei : 1; /* [13] */
  1281. __IO uint32_t eri : 1; /* [14] */
  1282. __IO uint32_t ais : 1; /* [15] */
  1283. __IO uint32_t nis : 1; /* [16] */
  1284. __IO uint32_t rs : 3; /* [17:19] */
  1285. __IO uint32_t ts : 3; /* [20:22] */
  1286. __IO uint32_t eb : 3; /* [23:25] */
  1287. __IO uint32_t reserved2 : 1; /* [26] */
  1288. __IO uint32_t mmi : 1; /* [27] */
  1289. __IO uint32_t mpi : 1; /* [28] */
  1290. __IO uint32_t tti : 1; /* [29] */
  1291. __IO uint32_t reserved3 : 2; /* [30:31] */
  1292. } sts_bit;
  1293. };
  1294. /**
  1295. * @brief emac dma opm register, offset:0x1018
  1296. */
  1297. union
  1298. {
  1299. __IO uint32_t opm;
  1300. struct
  1301. {
  1302. __IO uint32_t reserved1 : 1; /* [0] */
  1303. __IO uint32_t ssr : 1; /* [1] */
  1304. __IO uint32_t osf : 1; /* [2] */
  1305. __IO uint32_t rtc : 2; /* [3:4] */
  1306. __IO uint32_t reserved2 : 1; /* [5] */
  1307. __IO uint32_t fugf : 1; /* [6] */
  1308. __IO uint32_t fef : 1; /* [7] */
  1309. __IO uint32_t reserved3 : 5; /* [8:12] */
  1310. __IO uint32_t sstc : 1; /* [13] */
  1311. __IO uint32_t ttc : 3; /* [14:16] */
  1312. __IO uint32_t reserved4 : 3; /* [17:19] */
  1313. __IO uint32_t ftf : 1; /* [20] */
  1314. __IO uint32_t tsf : 1; /* [21] */
  1315. __IO uint32_t reserved5 : 2; /* [22:23] */
  1316. __IO uint32_t dfrf : 1; /* [24] */
  1317. __IO uint32_t rsf : 1; /* [25] */
  1318. __IO uint32_t dt : 1; /* [26] */
  1319. __IO uint32_t reserved6 : 5; /* [27:31] */
  1320. } opm_bit;
  1321. };
  1322. /**
  1323. * @brief emac dma ie register, offset:0x101C
  1324. */
  1325. union
  1326. {
  1327. __IO uint32_t ie;
  1328. struct
  1329. {
  1330. __IO uint32_t tie : 1; /* [0] */
  1331. __IO uint32_t tse : 1; /* [1] */
  1332. __IO uint32_t tue : 1; /* [2] */
  1333. __IO uint32_t tje : 1; /* [3] */
  1334. __IO uint32_t ove : 1; /* [4] */
  1335. __IO uint32_t une : 1; /* [5] */
  1336. __IO uint32_t rie : 1; /* [6] */
  1337. __IO uint32_t rbue : 1; /* [7] */
  1338. __IO uint32_t rse : 1; /* [8] */
  1339. __IO uint32_t rwte : 1; /* [9] */
  1340. __IO uint32_t eie : 1; /* [10] */
  1341. __IO uint32_t reserved1 : 2; /* [11:12] */
  1342. __IO uint32_t fbee : 1; /* [13] */
  1343. __IO uint32_t ere : 1; /* [14] */
  1344. __IO uint32_t aie : 1; /* [15] */
  1345. __IO uint32_t nie : 1; /* [16] */
  1346. __IO uint32_t reserved2 : 15;/* [17:31] */
  1347. } ie_bit;
  1348. };
  1349. /**
  1350. * @brief emac dma mfbocnt register, offset:0x1020
  1351. */
  1352. union
  1353. {
  1354. __IO uint32_t mfbocnt;
  1355. struct
  1356. {
  1357. __IO uint32_t mfc : 16;/* [0:15] */
  1358. __IO uint32_t obmfc : 1; /* [16] */
  1359. __IO uint32_t ofc : 11;/* [17:27] */
  1360. __IO uint32_t obfoc : 1; /* [28] */
  1361. __IO uint32_t reserved1 : 3; /* [29:31] */
  1362. } mfbocnt_bit;
  1363. };
  1364. /**
  1365. * @brief emac dma reserved1 register, offset:0x1024~0x1044
  1366. */
  1367. __IO uint32_t reserved1[9];
  1368. /**
  1369. * @brief emac ctd register, offset:0x1048
  1370. */
  1371. union
  1372. {
  1373. __IO uint32_t ctd;
  1374. struct
  1375. {
  1376. __IO uint32_t htdap : 32;/* [0:31] */
  1377. } ctd_bit;
  1378. };
  1379. /**
  1380. * @brief emac crd register, offset:0x104C
  1381. */
  1382. union
  1383. {
  1384. __IO uint32_t crd;
  1385. struct
  1386. {
  1387. __IO uint32_t hrdap : 32;/* [0:31] */
  1388. } crd_bit;
  1389. };
  1390. /**
  1391. * @brief emac ctbaddr register, offset:0x1050
  1392. */
  1393. union
  1394. {
  1395. __IO uint32_t ctbaddr;
  1396. struct
  1397. {
  1398. __IO uint32_t htbap : 32;/* [0:31] */
  1399. } ctbaddr_bit;
  1400. };
  1401. /**
  1402. * @brief emac crbaddr register, offset:0x1054
  1403. */
  1404. union
  1405. {
  1406. __IO uint32_t crbaddr;
  1407. struct
  1408. {
  1409. __IO uint32_t hrbap : 32;/* [0:31] */
  1410. } crbaddr_bit;
  1411. };
  1412. } emac_dma_type;
  1413. /**
  1414. * @}
  1415. */
  1416. #define EMAC ((emac_type *) EMAC_BASE)
  1417. #define EMAC_MMC ((emac_mmc_type *) EMAC_MMC_BASE)
  1418. #define EMAC_PTP ((emac_ptp_type *) EMAC_PTP_BASE)
  1419. #define EMAC_DMA ((emac_dma_type *) EMAC_DMA_BASE)
  1420. /** @defgroup EMAC_exported_functions
  1421. * @{
  1422. */
  1423. void emac_reset(void);
  1424. void emac_clock_range_set(void);
  1425. void emac_dma_software_reset_set(void);
  1426. flag_status emac_dma_software_reset_get(void);
  1427. void emac_start(void);
  1428. void emac_stop(void);
  1429. error_status emac_phy_register_write(uint8_t address, uint8_t reg, uint16_t data);
  1430. error_status emac_phy_register_read(uint8_t address, uint8_t reg, uint16_t *data);
  1431. void emac_control_para_init(emac_control_config_type *control_para);
  1432. void emac_control_config(emac_control_config_type *control_struct);
  1433. void emac_receiver_enable(confirm_state new_state);
  1434. void emac_trasmitter_enable(confirm_state new_state);
  1435. void emac_deferral_check_set(confirm_state new_state);
  1436. void emac_backoff_limit_set(emac_bol_type slot_time);
  1437. void emac_auto_pad_crc_stripping_set(confirm_state new_state);
  1438. void emac_retry_disable(confirm_state new_state);
  1439. void emac_ipv4_checksum_offload_set(confirm_state new_state);
  1440. void emac_loopback_mode_enable(confirm_state new_state);
  1441. void emac_receive_own_disable(confirm_state new_state);
  1442. void emac_carrier_sense_disable(confirm_state new_state);
  1443. void emac_interframe_gap_set(emac_intergrame_gap_type number);
  1444. void emac_jabber_disable(confirm_state new_state);
  1445. void emac_watchdog_disable(confirm_state new_state);
  1446. void emac_fast_speed_set(emac_speed_type speed);
  1447. void emac_duplex_mode_set(emac_duplex_type duplex_mode);
  1448. void emac_promiscuous_mode_set(confirm_state new_state);
  1449. void emac_hash_unicast_set(confirm_state new_state);
  1450. void emac_hash_multicast_set(confirm_state new_state);
  1451. void emac_dstaddr_inverse_filter_set(confirm_state new_state);
  1452. void emac_pass_all_multicasting_set(confirm_state new_state);
  1453. void emac_broadcast_frames_disable(confirm_state new_state);
  1454. void emac_pass_control_frames_set(emac_control_frames_filter_type condition);
  1455. void emac_srcaddr_inverse_filter_set(confirm_state new_state);
  1456. void emac_srcaddr_filter_set(confirm_state new_state);
  1457. void emac_hash_perfect_filter_set(confirm_state new_state);
  1458. void emac_receive_all_set(confirm_state new_state);
  1459. void emac_hash_table_high32bits_set(uint32_t high32bits);
  1460. void emac_hash_table_low32bits_set(uint32_t low32bits);
  1461. flag_status emac_mii_busy_get(void);
  1462. void emac_mii_write(confirm_state new_state);
  1463. void emac_fcb_bpa_set(confirm_state new_state);
  1464. void emac_transmit_flow_control_enable(confirm_state new_state);
  1465. void emac_receive_flow_control_enable(confirm_state new_state);
  1466. void emac_unicast_pause_frame_detect(confirm_state new_state);
  1467. void emac_pause_low_threshold_set(emac_pause_slot_threshold_type pasue_threshold);
  1468. void emac_zero_quanta_pause_disable(confirm_state new_state);
  1469. void emac_pause_time_set(uint16_t pause_time);
  1470. void emac_vlan_tag_identifier_set(uint16_t identifier);
  1471. void emac_vlan_tag_comparison_set(confirm_state new_state);
  1472. void emac_wakeup_frame_set(uint32_t value);
  1473. uint32_t emac_wakeup_frame_get(void);
  1474. void emac_power_down_set(confirm_state new_state);
  1475. void emac_magic_packet_enable(confirm_state new_state);
  1476. void emac_wakeup_frame_enable(confirm_state new_state);
  1477. flag_status emac_received_magic_packet_get(void);
  1478. flag_status emac_received_wakeup_frame_get(void);
  1479. void emac_global_unicast_set(confirm_state new_state);
  1480. void emac_wakeup_frame_filter_reset(confirm_state new_state);
  1481. flag_status emac_interrupt_status_read(uint32_t flag);
  1482. void emac_interrupt_mask_set(emac_interrupt_mask_type mask_type, confirm_state new_state);
  1483. void emac_local_address_set(uint8_t *address);
  1484. void emac_address_filter_set(emac_address_type mac, emac_address_filter_type filter, emac_address_mask_type mask_bit, confirm_state new_state);
  1485. uint32_t emac_received_packet_size_get(void);
  1486. uint32_t emac_dmarxdesc_frame_length_get(emac_dma_desc_type *dma_rx_desc);
  1487. void emac_dma_descriptor_list_address_set(emac_dma_tx_rx_type transfer_type, emac_dma_desc_type *dma_desc_tab, uint8_t *buff, uint32_t buffer_count);
  1488. uint32_t emac_dma_descriptor_list_address_get(emac_dma_tx_rx_type transfer_type);
  1489. void emac_dma_rx_desc_interrupt_config(emac_dma_desc_type *dma_rx_desc, confirm_state new_state);
  1490. void emac_dma_para_init(emac_dma_config_type *control_para);
  1491. void emac_dma_config(emac_dma_config_type *control_para);
  1492. void emac_dma_arbitation_set(emac_dma_rx_tx_ratio_type ratio, confirm_state new_state);
  1493. void emac_dma_descriptor_skip_length_set(uint8_t length);
  1494. void emac_dma_separate_pbl_set(emac_dma_pbl_type tx_length, emac_dma_pbl_type rx_length, confirm_state new_state);
  1495. void emac_dma_eight_pbl_mode_set(confirm_state new_state);
  1496. void emac_dma_address_aligned_beats_set(confirm_state new_state);
  1497. void emac_dma_poll_demand_set(emac_dma_tx_rx_type transfer_type, uint32_t value);
  1498. uint32_t emac_dma_poll_demand_get(emac_dma_tx_rx_type transfer_type);
  1499. emac_dma_receive_process_status_type emac_dma_receive_status_get(void);
  1500. emac_dma_transmit_process_status_type emac_dma_transmit_status_get(void);
  1501. void emac_dma_operations_set(emac_dma_operations_type ops, confirm_state new_state);
  1502. void emac_dma_receive_threshold_set(emac_dma_receive_threshold_type value);
  1503. void emac_dma_transmit_threshold_set(emac_dma_transmit_threshold_type value);
  1504. void emac_dma_interrupt_enable(emac_dma_interrupt_type it, confirm_state new_state);
  1505. uint16_t emac_dma_controller_missing_frame_get(void);
  1506. uint8_t emac_dma_missing_overflow_bit_get(void);
  1507. uint16_t emac_dma_application_missing_frame_get(void);
  1508. uint8_t emac_dma_fifo_overflow_bit_get(void);
  1509. uint32_t emac_dma_tansfer_address_get(emac_dma_transfer_address_type transfer_type);
  1510. void emac_mmc_counter_reset(void);
  1511. void emac_mmc_rollover_stop(confirm_state new_state);
  1512. void emac_mmc_reset_on_read_enable(confirm_state new_state);
  1513. void emac_mmc_counter_freeze(confirm_state new_state);
  1514. flag_status emac_mmc_received_status_get(uint32_t flag);
  1515. flag_status emac_mmc_transmit_status_get(uint32_t flag);
  1516. void emac_mmc_received_interrupt_mask_set(uint32_t flag, confirm_state new_state);
  1517. void emac_mmc_transmit_interrupt_mask_set(uint32_t flag, confirm_state new_state);
  1518. uint32_t emac_mmc_transmit_good_frames_get(uint32_t flag);
  1519. uint32_t emac_mmc_received_error_frames_get(uint32_t flag);
  1520. void emac_ptp_timestamp_enable(confirm_state new_state);
  1521. void emac_ptp_timestamp_fine_update_enable(confirm_state new_state);
  1522. void emac_ptp_timestamp_system_time_init(confirm_state new_state);
  1523. void emac_ptp_timestamp_system_time_update(confirm_state new_state);
  1524. void emac_ptp_interrupt_trigger_enable(confirm_state new_state);
  1525. void emac_ptp_addend_register_update(confirm_state new_state);
  1526. void emac_ptp_snapshot_received_frames_enable(confirm_state new_state);
  1527. void emac_ptp_subsecond_rollover_enable(confirm_state new_state);
  1528. void emac_ptp_psv2_enable(confirm_state new_state);
  1529. void emac_ptp_snapshot_emac_frames_enable(confirm_state new_state);
  1530. void emac_ptp_snapshot_ipv6_frames_enable(confirm_state new_state);
  1531. void emac_ptp_snapshot_ipv4_frames_enable(confirm_state new_state);
  1532. void emac_ptp_snapshot_event_message_enable(confirm_state new_state);
  1533. void emac_ptp_snapshot_master_event_enable(confirm_state new_state);
  1534. void emac_ptp_clock_node_set(emac_ptp_clock_node_type node);
  1535. void emac_ptp_mac_address_filter_enable(confirm_state new_state);
  1536. void emac_ptp_subsecond_increment_set(uint8_t value);
  1537. uint32_t emac_ptp_system_second_get(void);
  1538. uint32_t emac_ptp_system_subsecond_get(void);
  1539. confirm_state emac_ptp_system_time_sign_get(void);
  1540. void emac_ptp_system_second_set(uint32_t second);
  1541. void emac_ptp_system_subsecond_set(uint32_t subsecond);
  1542. void emac_ptp_system_time_sign_set(confirm_state sign);
  1543. void emac_ptp_timestamp_addend_set(uint32_t value);
  1544. void emac_ptp_target_second_set(uint32_t value);
  1545. void emac_ptp_target_nanosecond_set(uint32_t value);
  1546. confirm_state emac_ptp_timestamp_status_get(emac_ptp_timestamp_status_type status);
  1547. void emac_ptp_pps_frequency_set(emac_ptp_pps_control_type freq);
  1548. flag_status emac_dma_flag_get(uint32_t dma_flag);
  1549. flag_status emac_dma_interrupt_flag_get(uint32_t dma_flag);
  1550. void emac_dma_flag_clear(uint32_t dma_flag);
  1551. /**
  1552. * @}
  1553. */
  1554. /**
  1555. * @}
  1556. */
  1557. /**
  1558. * @}
  1559. */
  1560. #ifdef __cplusplus
  1561. }
  1562. #endif
  1563. #endif