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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' N7 d: V) Y  U1 c2 V: G4 v+ f
  1. [code]EDMA sample test application
    , O- h, t" x& L0 L$ \
  2. /** J  H& S: u2 ~1 E8 r
  3. * edma_test.c
    # \3 a6 M2 T1 x) S; t) h. F
  4. *
    3 I# N( h" \. e- E4 t* x
  5. * brief  EDMA3 Test Application
    . Y2 Q2 d) L! P* _& [/ L  m) ?
  6. *
    $ h. _- `6 h7 j$ X8 v
  7. *   This file contains EDMA3 Test code.
    $ B9 s! ~% S& R  C3 ?8 W
  8. *
    9 t0 H# M9 d# }5 S2 o* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 _) l4 X& z. a/ E% N& v8 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: C, V; X; ~3 R8 W' R, s; k
  11. *         TO CHANGE.( n. K% m) S: A
  12. *$ g1 I( `# g4 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; K# [4 t, U' c: l1 f4 a  c" k
  14. *" z% }2 r( r0 B9 Y! R
  15. * This program is free software; you can redistribute it and/or
    ! c4 `1 B. H. |* v, p6 A# T
  16. * modify it under the terms of the GNU General Public License as
    7 V0 M5 v. K! Y
  17. * published by the Free Software Foundation version 2.
    + v) N" H" A$ K1 ~
  18. *
    , I  O3 A) S  t1 R5 _2 \/ Q% g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) I& {7 J' u- ?0 V2 g- U
  20. * kind, whether express or implied; without even the implied warranty
    ( D- ]7 y) s: q* j$ O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 {/ l  S7 ^9 i- \$ Y: }
  22. * GNU General Public License for more details.
    # C/ v1 x% K1 m6 m% r
  23. */
    ! ?1 [0 h; d+ a( A% o, G
  24. 7 s0 X) J2 ^# d" j
  25. #include <linux/module.h>
    6 Q( b% N; W; Y' `
  26. #include <linux/init.h>5 d: G& J, m: k2 r$ M
  27. #include <linux/errno.h>8 v1 o. x+ f& x8 W% h/ S0 \
  28. #include <linux/types.h>
    ' x$ w. j; C3 p; U! c6 f1 M
  29. #include <linux/interrupt.h>
    # S$ u( j- R# B# S% `7 F
  30. #include <asm/io.h>/ G9 d* n* g: }4 y- d# W. T
  31. #include <linux/moduleparam.h>
    $ ~5 x$ v3 p2 k0 ^+ M
  32. #include <linux/sysctl.h>: |' f8 j( W6 Z6 D9 C; t9 N% Q
  33. #include <linux/mm.h>
    + R0 b4 R5 O1 j" o
  34. #include <linux/dma-mapping.h>
    ! O4 o0 y1 r) h  ?

  35. . W4 Q' b# ^9 Z7 i: x/ R& n
  36. #include <mach/memory.h>1 D3 @+ O4 O3 z8 [: {
  37. #include <mach/hardware.h>
    ( {9 q3 A) _; b
  38. #include <mach/irqs.h>8 f( V4 ~, d% _, Q, y
  39. #include <asm/hardware/edma.h>( x% E2 `! H" g" t
  40. - t& ^$ m+ k, o' J" e) ]* j/ ~
  41. #undef EDMA3_DEBUG
    4 Y4 V/ K. V. s; u' t
  42. /*#define EDMA3_DEBUG*/' p+ Y" }4 \! |
  43. 9 r- K- M1 h2 t$ F1 R0 g: o* V, i
  44. #ifdef EDMA3_DEBUG
    2 d7 e  w4 m! E& G1 R* R' u* l$ |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 S+ H4 Q) f3 d: `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 A, m( j2 f3 x0 G. i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); z2 T% D* v- a/ J6 U& {* c
  48. #else+ e- D. I3 s- u( A) {# [8 ?
  49. #define DMA_PRINTK( x... )
    3 I5 A  a; L0 J; G
  50. #define DMA_FN_IN
    # i- \6 j$ c+ h/ b$ Q& {0 ?
  51. #define DMA_FN_OUT
      x9 u7 X+ J/ Q% E
  52. #endif
    " q' r& `+ p8 L* |" P
  53. 2 m, w) o: ^6 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( v0 V% e# ]% ?; S! T
  55. #define STATIC_SHIFT                3
    " X' i; ]8 s1 X1 m' ^
  56. #define TCINTEN_SHIFT               20
    - W- ~8 ]) w4 G- K0 j; q
  57. #define ITCINTEN_SHIFT              21& c4 h6 N0 R1 S8 W% p2 |8 U
  58. #define TCCHEN_SHIFT                22
    9 @- _) J3 D" ~4 g
  59. #define ITCCHEN_SHIFT               23
    / M: f9 D! r$ g5 }; R) j( Y% `: z) Z
  60. 4 g. f' \% f- p) t1 g; r6 u
  61. static volatile int irqraised1 = 0;
    " h0 f" |8 \: {+ Z
  62. static volatile int irqraised2 = 0;
    / O# f2 @* C0 m$ [$ F

  63. ; }0 p) y" \1 d% L, N; S0 H- A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q) m! H: v9 V  [7 q0 c& @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T! a1 K/ o) g* ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ A( i8 a1 d  R4 e

  67. ! P9 I0 G  _! S# v
  68. dma_addr_t dmaphyssrc1 = 0;
    / O. ~6 A  l& ~* o6 G( J
  69. dma_addr_t dmaphyssrc2 = 0;
    - S$ \  m3 P: `! A
  70. dma_addr_t dmaphysdest1 = 0;7 w! I" \# B, [% K' n  h  k: r
  71. dma_addr_t dmaphysdest2 = 0;
    9 q- S$ }) _/ z7 x
  72. . u+ S) s8 O+ j) _: r( C) ~; _1 d
  73. char *dmabufsrc1 = NULL;
    0 c/ W) o# i& y9 l
  74. char *dmabufsrc2 = NULL;4 B0 P  H& f* [  b
  75. char *dmabufdest1 = NULL;
    2 i3 k: S, g: e( D' c; V+ B) n
  76. char *dmabufdest2 = NULL;  l& a3 D0 H' S9 S
  77. 6 Q/ o& ~0 A" m5 j" m' f  R5 K! e
  78. static int acnt = 512;
    & Z1 c# f9 X/ k
  79. static int bcnt = 8;8 r" q$ Q: b+ u7 S. H; j9 D7 `
  80. static int ccnt = 8;0 a% ]7 k9 T, i. y9 N/ }/ |, n; H' M
  81. ! `. {8 Z2 h% M6 J3 h9 n; R/ Y/ l: d
  82. module_param(acnt, int, S_IRUGO);
    ; L# Q7 ]. A" v0 ]# L
  83. module_param(bcnt, int, S_IRUGO);
    3 p& A3 q: f9 ~7 Y) G8 L; T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 O) I1 F' I3 r% C4 P" x! O

" R0 N/ g; J* `: N0 F( Y) @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' V. k- k7 Y) K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 K' d" f: o4 ~2 w$ q. G, A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |+ f8 O4 h, n, |3 m2 w4 y1 D; M
1 A* M; A$ H6 |; }9 r: K3 e- L) O

# y8 [8 D3 s5 U7 J& r$ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 04:31 , Processed in 0.040238 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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