OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 i: a# ^/ ], k+ L
  1. [code]EDMA sample test application( a! n* U1 i! }
  2. /*
    ! d+ l  t/ `6 f3 ~) Y
  3. * edma_test.c* F( b( y! k4 @' {
  4. *
    7 m$ g! ^, _! o! p: t1 R# {4 X  V: q
  5. * brief  EDMA3 Test Application
    , D  \! @' f) {
  6. ** T2 {9 o# p6 B( Q( R6 ]
  7. *   This file contains EDMA3 Test code.$ Q) M4 ~6 h; Z/ |/ i0 a
  8. *
    7 F- w# y) g* m( {' \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % G8 K0 j/ I0 W5 Y9 I1 j  k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) B* `! M; }1 T( k8 J. g
  11. *         TO CHANGE.+ P5 u- s4 y7 V3 Z' K' V$ A
  12. *7 r! w& P/ o: p2 p6 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % k# D6 J8 t3 X+ p! o" z
  14. *1 z! C5 _+ [$ _
  15. * This program is free software; you can redistribute it and/or8 U% s* X/ R. P
  16. * modify it under the terms of the GNU General Public License as( H7 U4 n$ Z  H8 R" i% N7 M# A
  17. * published by the Free Software Foundation version 2.  U* k: I* K4 x  w" ]
  18. *) L/ i9 B6 z8 f  t! ]" g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : n5 F' E& s1 P2 r3 w, ^- B
  20. * kind, whether express or implied; without even the implied warranty
    " `. W& `/ s7 F: N+ F6 u, z& n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 V! O- j. X' S+ l4 i) H# y
  22. * GNU General Public License for more details.& q! d8 }& M8 z* e1 @" H
  23. */' e* j2 Z4 x6 b5 T+ ?
  24. : p+ q' r- ?& Q! N1 E, @7 \
  25. #include <linux/module.h>
    1 m1 R( J( Y$ ?1 c2 \' O* R
  26. #include <linux/init.h>
    & B8 }0 Q3 `: f+ _, c3 i* q$ E
  27. #include <linux/errno.h>
      H' [% s4 q  G0 q+ K% s8 r
  28. #include <linux/types.h>
    9 R& W3 G* N0 f2 o5 S
  29. #include <linux/interrupt.h>
    - h2 L  B) ^3 \" I
  30. #include <asm/io.h>9 z" l1 H  i( \" R# c
  31. #include <linux/moduleparam.h>! R& K/ ]4 q- \) K' C
  32. #include <linux/sysctl.h>" i9 q: E, \1 C; r  P; B
  33. #include <linux/mm.h>7 v# j8 o0 `4 h8 h# L
  34. #include <linux/dma-mapping.h>
    ! y; m) ~, w6 U) v/ Y: g
  35. 9 q& Q% ?* B, `! t: I- g8 A1 V
  36. #include <mach/memory.h>8 `+ ~$ m! o6 L( C4 T+ P2 k; O
  37. #include <mach/hardware.h>. P& g2 Z. i8 O7 Z( j: p
  38. #include <mach/irqs.h>7 p! D  F; L( v; C4 ^
  39. #include <asm/hardware/edma.h>' Y& t, W! N7 s1 b  ~# \* u

  40. + {) R8 s, [3 S6 U5 e
  41. #undef EDMA3_DEBUG3 {/ `4 P2 f4 Z; _4 {
  42. /*#define EDMA3_DEBUG*/
    : w! v3 T. j4 H2 c* T# R4 A

  43. $ \- O8 J. q' A) ]- w: n0 ~
  44. #ifdef EDMA3_DEBUG& \( H6 u/ M1 p" I& q. z1 M1 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' Y5 v( v( r7 F  H: N) v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~3 ]7 q4 h0 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g1 T' u. m9 }0 |+ k" g/ {9 |
  48. #else6 @7 g3 k9 U, f# r/ A
  49. #define DMA_PRINTK( x... ). z7 X! M7 i  O( o/ `$ f: x( Y) ]
  50. #define DMA_FN_IN
    1 Q& o$ N# q2 d8 o* m3 y
  51. #define DMA_FN_OUT) W& |/ c! r4 ?- a# o
  52. #endif
    & [: h7 n! p. z
  53. 4 Y% X$ z7 Q' x" m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! g/ `; H- p3 y7 |6 h5 J" m! A/ e
  55. #define STATIC_SHIFT                3/ R+ j- `" O2 [1 [% A7 s. k
  56. #define TCINTEN_SHIFT               20
    ! S6 A6 W6 |4 T0 ?
  57. #define ITCINTEN_SHIFT              21
    3 M" l/ ]! a2 E9 v3 J; G
  58. #define TCCHEN_SHIFT                22/ |2 c( V$ H2 r+ A
  59. #define ITCCHEN_SHIFT               23' L5 J! c2 Q0 m4 \* c& h/ |" U

  60. ! b1 s$ {; i  ~9 ]# H8 Z% l
  61. static volatile int irqraised1 = 0;& X; a, X" x3 L' y( Y( E
  62. static volatile int irqraised2 = 0;# p: I8 [" c  j# a# s
  63. 0 `* L8 P7 @1 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O6 P# @% V- l1 j9 G- v, J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m! f6 V( d. c; f+ s7 Z: S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @6 ~$ X6 W8 ^5 M) _

  67. & x! m/ s9 t2 S# x
  68. dma_addr_t dmaphyssrc1 = 0;
    & g! A$ o# l$ `% D9 d( T
  69. dma_addr_t dmaphyssrc2 = 0;1 O/ t& a# ~: c2 ~5 |! L' p
  70. dma_addr_t dmaphysdest1 = 0;
    / w: {3 q7 e- P* k
  71. dma_addr_t dmaphysdest2 = 0;1 D: W9 ^* M0 r- f4 {
  72. 5 u3 L9 {# ?! E* W
  73. char *dmabufsrc1 = NULL;
    1 f, a1 q& @0 C0 N! L6 ~
  74. char *dmabufsrc2 = NULL;6 H% s4 A( i+ J5 O) S0 E5 Q/ h
  75. char *dmabufdest1 = NULL;
    $ J9 m7 I' F, {( a2 P
  76. char *dmabufdest2 = NULL;' ~+ n" U5 j1 A/ b3 L

  77. - P: b0 @" X( n) t1 m$ k
  78. static int acnt = 512;
    / ^, \! m3 H3 ]' S4 X3 D
  79. static int bcnt = 8;
    5 a4 [( }" W( V' d
  80. static int ccnt = 8;
    + Y6 F& L+ i+ ]

  81. ; U% g' m! s3 ~* \% {/ f+ J4 x
  82. module_param(acnt, int, S_IRUGO);) C7 r/ Y# ?$ a" V" ]1 W9 P- @* r; P
  83. module_param(bcnt, int, S_IRUGO);
    . F- B4 g% b! i7 n- C; _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 f0 H0 V. j* P- A
: o6 s9 H# c# {6 M+ _; ?3 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; O3 L+ {# U2 Q" a' J$ E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ~( x. K0 t  e/ H, i! Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 @) E  x4 R2 [# a5 D7 z7 d$ S5 x0 |
% I" y& \3 y* f9 p! S: d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-12-3 16:39 , Processed in 0.040189 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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