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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Y5 G* y& y! S. S) e/ h
  1. [code]EDMA sample test application9 x9 x% O( B0 T- t, m9 W
  2. /*8 d6 U' c1 k5 i# f/ `' _5 m
  3. * edma_test.c
    . X1 q3 t* {3 N( T
  4. *( F/ f: O1 T0 `+ \
  5. * brief  EDMA3 Test Application3 }+ Q) [( p- ^0 W
  6. *) X5 k! Y2 Y# @, P0 F9 A
  7. *   This file contains EDMA3 Test code.3 j+ c' F9 B# F2 w4 v+ h
  8. *
    $ |+ C- P: ?/ \; g' }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ x9 Q2 r0 D& ^& p4 C/ b. ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / W, n" @; t% T1 ?& Y( i; O$ E
  11. *         TO CHANGE.
    ) C! ~2 n' }9 @/ c
  12. *' R/ H% l3 l1 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ^; E! v0 Z& W7 {+ s3 a9 t  f  y
  14. *
    0 u7 Q- Q8 l) {2 R3 o6 J& O
  15. * This program is free software; you can redistribute it and/or4 W2 \, L! ~7 ?' T5 k" ~% T) {1 T$ h
  16. * modify it under the terms of the GNU General Public License as
    $ t5 l! ?$ @& S3 l* V( r& }
  17. * published by the Free Software Foundation version 2.
    * X* ^* O4 c( _+ R0 H: D& K  E
  18. *1 i8 V3 D  P" w* c; X$ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* l. X2 y- }* j! k
  20. * kind, whether express or implied; without even the implied warranty
    , j; e0 r7 a1 }. L4 Q0 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / x1 w  v, p1 [# g
  22. * GNU General Public License for more details.
    4 X! U! M- W8 _/ U9 X, V$ s
  23. */
    ( l$ @# S# m) z
  24. ! n' a/ B) o8 }
  25. #include <linux/module.h>
    # a( O# H4 I$ G: L$ g. J- w8 @. G
  26. #include <linux/init.h>1 p; s; T6 \7 z; S, C7 J5 M
  27. #include <linux/errno.h>: g9 J  [; S/ u( A( y5 @
  28. #include <linux/types.h>: P/ o) r5 m0 k7 |0 x6 Y
  29. #include <linux/interrupt.h>! v2 m& R* [: M' D
  30. #include <asm/io.h>
    ( e* z6 @! `. p9 i$ m( B) R3 q7 c
  31. #include <linux/moduleparam.h>  Q- s6 Z0 v" l/ l
  32. #include <linux/sysctl.h>
    # {8 M* {2 a8 ?: T3 D% ^
  33. #include <linux/mm.h>
    - g% U7 E( @  o- V
  34. #include <linux/dma-mapping.h>
    2 p6 ?+ G+ @% Y3 @4 f4 G

  35. & B" W: _4 [8 s# L
  36. #include <mach/memory.h>, R9 V7 o: H( y2 |4 E- I; A
  37. #include <mach/hardware.h>
    + Q8 r0 i  t: V8 ?5 h
  38. #include <mach/irqs.h>
    # s% O3 H4 _) G9 Z
  39. #include <asm/hardware/edma.h>
    3 J( g+ H6 v) Y: e6 e9 x: ^

  40. 6 ]& L+ \9 m: y, l
  41. #undef EDMA3_DEBUG
      }/ G; r. Q) y/ D8 P
  42. /*#define EDMA3_DEBUG*/( r& t& u) f7 D( u' k2 X6 L( D
  43. 2 d4 Z" h$ U4 z$ z. l
  44. #ifdef EDMA3_DEBUG
    * n2 [6 k3 B1 b" v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). g# G5 }( y& U; }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 P5 h# j4 w$ `" F! O0 w9 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 O5 Z, V2 c$ t- x3 F0 R
  48. #else
    - U- `" U& P1 H9 Y+ U+ x# G
  49. #define DMA_PRINTK( x... )& ?( T5 w. S8 V8 d3 W* n  `& U8 i
  50. #define DMA_FN_IN5 H4 d/ c, ^! Z% @" R1 ?- w
  51. #define DMA_FN_OUT
    8 R* Y/ ]5 B5 }( j6 @
  52. #endif! n8 N) o3 @- ]9 ^( @3 C% @
  53. 3 M' m9 [4 }8 q/ K7 K- w9 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! M4 v, J1 C1 ]% D4 O0 `! E1 d' a
  55. #define STATIC_SHIFT                3& u/ U1 A# d9 N+ y0 r+ ^% r
  56. #define TCINTEN_SHIFT               20
    0 y" i7 j+ C$ [( [$ p1 b# {  J
  57. #define ITCINTEN_SHIFT              212 ^+ W/ p. W* z" F0 _! F, Y
  58. #define TCCHEN_SHIFT                225 [3 d  t: N1 p2 f
  59. #define ITCCHEN_SHIFT               23
    $ V! @. P! ^) Y! N
  60. . \2 N' w. i$ D' f
  61. static volatile int irqraised1 = 0;
    1 j( T* a' [; _1 W1 q9 D8 F  o9 U
  62. static volatile int irqraised2 = 0;
    + [+ A& i# w/ E7 K) ]

  63. 6 C- n7 C. n3 U4 ?3 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 s5 O2 }! v  s& Y4 e4 u$ ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ~6 P; T6 @8 `3 e* O# r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [' H6 a. l! b8 {( E  D
  67. 0 T4 b6 |* D" F, R
  68. dma_addr_t dmaphyssrc1 = 0;
    ' K, @/ h# ^2 R( T, b
  69. dma_addr_t dmaphyssrc2 = 0;# S. R4 O, _5 P0 ~
  70. dma_addr_t dmaphysdest1 = 0;
    ' j. \+ ~) ^6 p; L2 X( S! k
  71. dma_addr_t dmaphysdest2 = 0;3 |% t6 j" Q& E3 S- R- s/ `5 f
  72. + ^5 e" O$ D$ u8 ~8 I  a- }1 C
  73. char *dmabufsrc1 = NULL;# d2 j1 k4 B9 E7 x6 m
  74. char *dmabufsrc2 = NULL;1 H2 a' ^8 N1 ~- l: l6 Z
  75. char *dmabufdest1 = NULL;' x) {, u) p/ w
  76. char *dmabufdest2 = NULL;
    1 r1 }* e% a4 q5 v* y0 ~' M5 c- {
  77. $ e# Z) N: j' j2 u" U3 ~& n) X' o
  78. static int acnt = 512;4 `6 N; I5 x- a9 s, `
  79. static int bcnt = 8;! y( ^% k9 R( O5 v+ M! q
  80. static int ccnt = 8;8 N0 F- y5 X4 d7 H7 V- k

  81.   H, I$ }3 T2 y4 V* F5 W
  82. module_param(acnt, int, S_IRUGO);+ V( W- ]6 p3 I: S" D  ?) b
  83. module_param(bcnt, int, S_IRUGO);" [8 I5 }! q8 g$ m. z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: D% k5 l* w% ~
/ Z: P% F/ b) L  C3 A4 d" F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 q4 `1 @: w$ A- d+ @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ \3 |  Y7 A, {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 H' v# P$ P6 L4 x% h
- ]: ?  N- _% r, Z9 F+ M
* ?0 W) g' @" X0 H3 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 21:50 , Processed in 0.038962 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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