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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Q/ z; v* \. m/ L$ y) W$ U
  1. [code]EDMA sample test application7 w0 [5 ]: ^) y2 x, W  P) Y
  2. /*
    " C  H4 r+ w$ E9 I% o. A6 s
  3. * edma_test.c
    : v9 [3 V+ V, H6 ^" D: e/ D& E
  4. *
    $ r& ]' l) M4 E: T/ S+ U( u  h
  5. * brief  EDMA3 Test Application9 E- u8 \/ u" Z5 G8 U+ e# w
  6. *- k1 h! c2 L9 P
  7. *   This file contains EDMA3 Test code.
    % R# D' n5 k$ Y/ f' B
  8. *
    7 v- `$ N( T) t0 ]" ^) g/ C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 {  m9 t# b6 Q( m- G5 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) l6 C! L. F9 ?6 n
  11. *         TO CHANGE.
    , f1 J# v( e; c
  12. ** J! D6 F3 r+ _  |, t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : F" L' k) ]' a
  14. *
    4 ~  X) N" Q* B! ^) {' R  ^  q
  15. * This program is free software; you can redistribute it and/or8 ]: P! X5 `4 c0 d% n- ~, n
  16. * modify it under the terms of the GNU General Public License as
    ( U# X( A, @4 O; H2 w. y5 [; t
  17. * published by the Free Software Foundation version 2.0 m2 Y. L# t$ ~, |2 o1 }
  18. *
    : P; _! q! @; @3 N" c9 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" f6 \, G6 E' ~$ t' g
  20. * kind, whether express or implied; without even the implied warranty
    ' v8 X6 |, m$ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # f2 V6 ?- H. z7 ]" [& A6 O
  22. * GNU General Public License for more details.: ?" `6 w$ a' V& S* h
  23. */
    1 R. W! M4 B: J8 B; `
  24. ( P- S7 k$ @2 \3 ^8 }8 g1 Z
  25. #include <linux/module.h>
    4 a0 N% b3 S8 v8 F( i
  26. #include <linux/init.h>, c' y* a& }" U
  27. #include <linux/errno.h># p" R. b4 E, z( C' R) p9 i
  28. #include <linux/types.h># _- f7 F6 L4 @% K  ~
  29. #include <linux/interrupt.h>0 @9 [7 O# m8 F3 e
  30. #include <asm/io.h>) j: p+ ^) p+ x% `& `& w# o; Z' m: C, I' ~
  31. #include <linux/moduleparam.h>
    - L- |# S1 N) K! ~! ]8 k; g
  32. #include <linux/sysctl.h>
    3 h) O4 q% t8 \* o: T9 e2 Y$ e
  33. #include <linux/mm.h>, C: o* q" `  |4 Z5 O
  34. #include <linux/dma-mapping.h>& X3 @- B, K, t
  35. 1 t+ \9 i# v1 c0 X, y. w- H" r
  36. #include <mach/memory.h>8 ?6 m$ m; a, r" X" u& a& e& @
  37. #include <mach/hardware.h>! f# H, l. F2 I* L, u, T
  38. #include <mach/irqs.h>, L, M2 I  R& S( L4 d* m
  39. #include <asm/hardware/edma.h>3 D* S! `* }* B9 J0 l

  40. 0 j+ @' ]5 _/ ~8 I# f' k( O2 c5 E
  41. #undef EDMA3_DEBUG1 X, n6 h: {/ Z# ~1 H
  42. /*#define EDMA3_DEBUG*/
    5 z! x& A% T5 d; ^# A/ C* m
  43. 2 p9 R- }) j2 a4 ^
  44. #ifdef EDMA3_DEBUG
    ! ]9 U7 {' c( M7 Z0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& [: s/ r1 q) s) C4 R4 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' F5 A% [+ q% _5 Z% i3 f/ p  T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ^- m3 o/ I& R: R8 ]4 A& N7 u
  48. #else
    ) s) Y' K( P. n
  49. #define DMA_PRINTK( x... )+ l2 I) N5 E) m( P2 V. l
  50. #define DMA_FN_IN4 o) d' _9 r. F5 N
  51. #define DMA_FN_OUT) s6 U& O( |. h: ~
  52. #endif
    1 m8 D7 ~3 C$ Q. o
  53. 9 B/ h* O* [7 J/ N) S7 `3 h% R# R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ [! {( d. V) ?0 `! _9 }( Q1 t8 ^( x
  55. #define STATIC_SHIFT                3+ [# I5 }* s$ l
  56. #define TCINTEN_SHIFT               20; t8 K$ [1 I4 R3 A+ s; i+ @. ]
  57. #define ITCINTEN_SHIFT              21! H6 ?0 s7 B' }: U% P* M/ C
  58. #define TCCHEN_SHIFT                22
    1 Y6 x- _# z% y. N% L
  59. #define ITCCHEN_SHIFT               23. Q( k* Y$ V5 o4 R3 v. _' ^! X

  60. 2 i! B( g  g8 U7 H/ d$ h' \
  61. static volatile int irqraised1 = 0;$ h! N# A6 ]% s. E% C; G
  62. static volatile int irqraised2 = 0;
    / e) f) a$ h/ X; M/ Z+ p$ h
  63. 7 i- c# `, i% W  h! U4 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 c: `: a) @" B8 O6 k- o+ R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R/ ^7 a4 @: N; j* i% X- ?5 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |( n9 _1 k/ T6 D# x

  67. + \( C  b; i) c
  68. dma_addr_t dmaphyssrc1 = 0;
    * {5 B) d# L: ?# S# a3 Y
  69. dma_addr_t dmaphyssrc2 = 0;; @* q+ V. \( ^* r
  70. dma_addr_t dmaphysdest1 = 0;
    ! x* Z6 i6 d$ t% N( K  j3 h
  71. dma_addr_t dmaphysdest2 = 0;$ {) k; i, U8 J1 i; _' [8 U
  72. 8 f- k, {& z3 q6 |! a( @
  73. char *dmabufsrc1 = NULL;1 s( ?* F4 u+ H, M, b; A( e# m  A. g
  74. char *dmabufsrc2 = NULL;
    ; g0 X& e$ G$ R
  75. char *dmabufdest1 = NULL;, `. z0 J; b- R6 @5 ^4 W& ^
  76. char *dmabufdest2 = NULL;/ y3 P/ d9 W6 E, K
  77. + u9 f! J6 Z& Q, J6 K% _
  78. static int acnt = 512;
    8 p  x3 `( E  g1 ]: c3 V; L
  79. static int bcnt = 8;9 C; g' Z2 p% L; f1 G1 R# O
  80. static int ccnt = 8;$ g7 X( f; Y  t( o4 L* v& K
  81. % Q4 z- ~& L( X! ?+ M
  82. module_param(acnt, int, S_IRUGO);2 X  O0 c( G% w4 v4 u5 A3 }
  83. module_param(bcnt, int, S_IRUGO);2 F: P. K: q9 e' b4 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ y  K% Q5 s' x+ R
' Z$ q: ?0 E3 ?) [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& L' P6 c6 w* K' }0 W! iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ T/ [  E5 b/ j0 v& P+ `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% o) T  d" ^1 E" p
9 p2 C/ ^) y8 U* w4 t9 f' s- y6 X
! u( }' I: |6 b% X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 19:57 , Processed in 0.039490 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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