OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7994|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 w3 z% F# r6 `! B' \, G
  1. [code]EDMA sample test application
    ! G8 A9 }" m, P  {1 }$ ^
  2. /*3 ^1 y$ z( C0 a
  3. * edma_test.c
      R& I- x# R' J6 S& {
  4. *0 {4 w' d" x+ @0 ]
  5. * brief  EDMA3 Test Application
    ; V& A1 ~6 q! R2 z7 j" f
  6. *% L/ `  _; Z- A! G
  7. *   This file contains EDMA3 Test code.( I* b- ^" [0 M& l. i
  8. *
    ! B! k+ }6 Z9 K5 I5 F# r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 P# N6 ]8 P% r4 V# A. G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* O* d' D  c5 R
  11. *         TO CHANGE.
    $ S- K5 `3 {9 P9 e- h/ b2 p
  12. *' e. t  v' K! g/ ~' X# A" K$ x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! z6 A9 m3 T2 v- J+ B
  14. *
    . l0 H; M  o' f& W6 I( I9 E- o
  15. * This program is free software; you can redistribute it and/or
    * U: C1 T- C% @$ R5 v
  16. * modify it under the terms of the GNU General Public License as0 V9 r$ D6 m: p; t$ n/ Z
  17. * published by the Free Software Foundation version 2.5 }% F8 c; G0 V! Q/ m
  18. *; U% z: ^- {( W; n9 Q2 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 R) s$ p4 t: t+ N
  20. * kind, whether express or implied; without even the implied warranty
    # g7 `% e# F! C' c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; @& s  ]) s4 b
  22. * GNU General Public License for more details.- ~6 r4 {+ o$ i( g% S% S2 p. D
  23. */
      E5 E+ N- `; O( Q0 D) T7 D$ ^# X
  24.   ]1 }! p' ]) T* D
  25. #include <linux/module.h>. g7 d# u' C+ c, ]9 E$ w% ^* [% q
  26. #include <linux/init.h>$ o/ Y/ p' X& C6 w8 e
  27. #include <linux/errno.h>- X& q6 `+ D5 B& g9 C/ P
  28. #include <linux/types.h>
    & ?3 N& B0 u! V* G4 D: W. y
  29. #include <linux/interrupt.h>
    4 z1 B9 H5 z" N& l& k  u
  30. #include <asm/io.h># S& v- D8 T. H- ?/ ~
  31. #include <linux/moduleparam.h>0 t" w5 w6 T9 q# F
  32. #include <linux/sysctl.h>
    6 N4 j% X2 h8 N
  33. #include <linux/mm.h>
    / W1 M/ x; F$ o% x9 X( [1 Z% H
  34. #include <linux/dma-mapping.h>. H6 g- l% `' e8 i/ a

  35. : e: r2 Y2 x+ y1 L
  36. #include <mach/memory.h>
    1 v, Y. J1 e  w9 G2 e: H) t
  37. #include <mach/hardware.h>
    9 W* I- P" F* U! v
  38. #include <mach/irqs.h>  w  {& `& u( x! U: f
  39. #include <asm/hardware/edma.h>
    & Q+ j& ]7 A* @- ?9 Z
  40. / ^* e% u* q4 D  K- z0 @% K
  41. #undef EDMA3_DEBUG
    . Z, {$ `8 |2 f( c; G1 O+ A5 z1 T0 O
  42. /*#define EDMA3_DEBUG*/
    3 ^& l8 \) R% C$ U/ i5 w+ Z: H* T0 ^
  43. 4 K2 ^6 E. m& v' M  n3 B
  44. #ifdef EDMA3_DEBUG
    # [$ g* r! Y% ^9 V, v: X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 k3 h+ P5 |; W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      a! D" U9 n% }2 Z9 z* @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% V- X5 x6 }" a
  48. #else. Q/ I% [9 i$ D
  49. #define DMA_PRINTK( x... )5 I4 X) e9 p1 [; h
  50. #define DMA_FN_IN
    8 O. q" K) ?( n  H/ D
  51. #define DMA_FN_OUT0 B, Q" v& m  P+ L* Y5 P0 K  m+ }1 i
  52. #endif
    3 P: Z, Q# i! {( H
  53. 1 |+ o' k& @7 n2 h/ D' Q. K6 k: P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) }0 r  a1 p* O5 [7 C  P3 u
  55. #define STATIC_SHIFT                3
    # ~8 ~! `5 F, T
  56. #define TCINTEN_SHIFT               20$ h, ]# P' ?" N1 p4 m
  57. #define ITCINTEN_SHIFT              21; u! X& G2 }1 L' d3 ]1 P) e/ Z& j
  58. #define TCCHEN_SHIFT                22& [$ P( Q: s$ u# q; `+ L
  59. #define ITCCHEN_SHIFT               234 r" X! }- i) K( M1 s3 b) ^1 y9 }
  60. : N1 {& G6 U" F( J1 n4 l; Y
  61. static volatile int irqraised1 = 0;$ H0 s/ R9 t% x
  62. static volatile int irqraised2 = 0;
    * }" Q0 ~; H9 B% k8 j
  63. 9 D3 ?$ [9 Z! L# ~" y( z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?. ^8 ?& o. G; L* ]7 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! U6 b) }* w+ S- u( h+ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; b5 R! p9 t9 d% C  H
  67. 6 Q4 O, U$ o3 p4 Y  a  Y# q3 U, b
  68. dma_addr_t dmaphyssrc1 = 0;
    8 n, X3 y8 b! d4 R- d9 s0 b
  69. dma_addr_t dmaphyssrc2 = 0;0 t: o9 A& M2 y* `* q
  70. dma_addr_t dmaphysdest1 = 0;* x" `$ T5 b( t: M) ^
  71. dma_addr_t dmaphysdest2 = 0;
    ; K  V- x; C( {9 h0 m8 C  f
  72. ; s% E7 n% J( i  j. A
  73. char *dmabufsrc1 = NULL;: T1 B1 f  d, g3 A1 H8 ~7 a! G  W
  74. char *dmabufsrc2 = NULL;4 x: l6 q% A8 I2 j0 X2 X
  75. char *dmabufdest1 = NULL;
    % `8 s" A. Y9 U
  76. char *dmabufdest2 = NULL;
    . T, E$ }& D7 q  N$ l( r
  77. % t3 m7 M8 C1 H  q* U1 O
  78. static int acnt = 512;! H' C+ D9 x( \/ R
  79. static int bcnt = 8;
    4 T( B' z5 d7 F) Q  k# _/ b
  80. static int ccnt = 8;$ y9 [% R0 ~% g% b2 F' K4 w

  81. , B4 Y( q7 v3 f! ]5 w$ H9 x- p
  82. module_param(acnt, int, S_IRUGO);6 g5 j. z, j/ h1 C
  83. module_param(bcnt, int, S_IRUGO);' X+ R: P7 F3 {1 N! |! k2 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) x: I0 o/ k) \  U& w1 m& p4 M* P, u( w' o5 m( W; e! v# @2 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E- D& ?' g: M2 O" \+ v
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( C; C# N' F6 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 W/ g# C3 s9 Q$ `6 p/ v
; S5 y; ?' J( D4 P( Q. U

: ~- ?8 S) w5 t2 ~8 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-10-15 15:18 , Processed in 0.037217 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表