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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ?- R: E0 q, c; g3 E: M
  1. [code]EDMA sample test application
      l0 t2 |6 t; D2 i- s7 ]
  2. /*4 Q; }/ r- v) v8 h
  3. * edma_test.c
    2 E6 _: ]+ E+ D7 ]- q& v; K9 t1 h
  4. *
    $ l6 K* O5 @$ K: K4 a9 _
  5. * brief  EDMA3 Test Application
    8 M2 c7 Q# Z4 r7 Y5 D+ N
  6. *9 n8 ?7 s9 I- e% O8 Z6 N3 D- ~
  7. *   This file contains EDMA3 Test code.
    # k7 J- R1 K7 w% f- \
  8. *" Y* A9 r' M% o& Y0 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- K/ m' A2 |5 U) j+ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Q" ~2 F# F5 d& x: O
  11. *         TO CHANGE.
    ( S, c+ e- W# m9 H$ R8 v
  12. *0 ]8 F5 m/ N: O" U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' Z8 R' K$ k7 f& u
  14. *. E: [! Y) b7 a* T: m) x
  15. * This program is free software; you can redistribute it and/or( h, v9 U& e' Z! W
  16. * modify it under the terms of the GNU General Public License as
    * ^5 G; q1 X+ Y, E/ \+ F
  17. * published by the Free Software Foundation version 2.
    $ j1 a0 Q$ ]' n
  18. *9 T" D. N0 o+ U* _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : B! x1 h, c( p+ x: d  a$ n
  20. * kind, whether express or implied; without even the implied warranty' f5 R# }) P& n, ]8 @' b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + w3 g6 a3 H  t0 ?/ |
  22. * GNU General Public License for more details.  j0 M4 A$ g* j2 I- [
  23. */
    4 \& @' j) K3 K6 |8 L
  24. 4 T% c, l( _0 E
  25. #include <linux/module.h>
    5 @" S4 Q- |, \1 j+ j4 T" M. R2 r) j- v
  26. #include <linux/init.h>  ]% A; Z; ^+ m; X5 P4 B
  27. #include <linux/errno.h>0 p6 }- d1 g6 G4 `8 o$ O: ~( o
  28. #include <linux/types.h>
    ' i. P9 F0 m1 W1 N
  29. #include <linux/interrupt.h>
    ; R- X$ `) z9 _4 H
  30. #include <asm/io.h>
    2 Q- }, |4 b4 m4 s1 P# v
  31. #include <linux/moduleparam.h>
    0 }$ G' `) `  ?, f% p. }
  32. #include <linux/sysctl.h>. A+ G* B6 |& ?5 `8 e/ }+ r7 V7 A
  33. #include <linux/mm.h>* Z. ~* `' p2 f
  34. #include <linux/dma-mapping.h>) m& O/ q$ u* ^6 J$ V
  35. * n" Q3 g% y( e/ r
  36. #include <mach/memory.h>
    % L* P4 k9 E7 Q
  37. #include <mach/hardware.h>
    8 b9 ~. Q  c( @1 d( E
  38. #include <mach/irqs.h>
    # P, b; q: ~# f! K: ^
  39. #include <asm/hardware/edma.h>
    2 Y, m$ b2 K1 g1 G
  40. ' Q/ [" C$ D' {9 k
  41. #undef EDMA3_DEBUG1 K4 t, u2 n/ e! j7 T
  42. /*#define EDMA3_DEBUG*/8 P/ @$ n0 \6 [& x2 l4 ~
  43. # S6 C: j7 n7 i5 @( E1 \
  44. #ifdef EDMA3_DEBUG. p9 t9 A7 C7 f1 t% l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) k. h4 [/ U8 y, L6 M0 |0 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # x1 z5 E/ B- [( ?. Z  Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" U. ?, r) P) ?" J& Q6 q
  48. #else1 y) n0 y, g& {
  49. #define DMA_PRINTK( x... )
    : @* o) |: v0 A+ h
  50. #define DMA_FN_IN
    1 f: b: T/ Z1 F) }* `
  51. #define DMA_FN_OUT# p- A: L6 J1 m, A! Q
  52. #endif
    + y5 E8 C! x- C8 Q

  53. * {$ _3 }* W3 C% _+ i- g: R" \( \$ L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* ~% j. l& r" H% j3 K( m
  55. #define STATIC_SHIFT                3
    , E( D% T- Q; V+ c. e" I# a
  56. #define TCINTEN_SHIFT               20
    7 d  q" ]. I$ }( `5 b. J; w/ \
  57. #define ITCINTEN_SHIFT              21
    ( @% q4 V5 O1 u9 s. @
  58. #define TCCHEN_SHIFT                22
    ' `( P2 z) L! C) c* G
  59. #define ITCCHEN_SHIFT               23
    / O0 ?5 f6 G4 l! Y2 G
  60. 5 l/ h, Q5 @4 V+ I% [
  61. static volatile int irqraised1 = 0;
    $ x' u" t5 p! h3 u' O5 M
  62. static volatile int irqraised2 = 0;
    8 M1 v) H  Z) Q! F8 _( O# d' d

  63. 9 T, ~0 z1 C: ^1 s, u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f. T# w6 r5 B+ E- t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 c( T5 ?* ?  [2 ^# _# D( B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' h$ p' U) z# T. Y

  67. - i! z& B3 @8 m. f* f) W# Y
  68. dma_addr_t dmaphyssrc1 = 0;+ }8 V# N* C5 R. P7 N' H; |6 V
  69. dma_addr_t dmaphyssrc2 = 0;
    9 N1 V; X+ ]+ D; `
  70. dma_addr_t dmaphysdest1 = 0;
    - j7 d" y/ [6 D* d- f4 p7 C+ j
  71. dma_addr_t dmaphysdest2 = 0;9 y1 b& {7 y; b! N/ S2 I  r

  72. ' _6 @* G) K( m
  73. char *dmabufsrc1 = NULL;/ B8 B, N' `' a: z  V' Y1 W% }
  74. char *dmabufsrc2 = NULL;( ^" r9 b4 c8 i0 F
  75. char *dmabufdest1 = NULL;! m- C! n* U( ]/ B) n" E2 }
  76. char *dmabufdest2 = NULL;
    " m( ^/ p$ Q6 ?3 ]7 [& F% F5 U

  77. 9 M% n  i& C; x7 G: q
  78. static int acnt = 512;5 K( L3 Y: W2 z3 \1 M, W. q
  79. static int bcnt = 8;4 W+ M, d5 j( M+ |$ g( I% q
  80. static int ccnt = 8;, R6 _4 v0 H1 i. O" Z
  81. + B9 r) @0 U  H) b$ [/ t0 _! }
  82. module_param(acnt, int, S_IRUGO);
    7 ~( u" q4 B1 H. P% R
  83. module_param(bcnt, int, S_IRUGO);: V1 Q  n- A% A  j0 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 d1 U3 D4 F# s) o) X& |0 X  l: R. ~& T: _+ W9 W2 K' T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o2 |1 o# C6 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 |8 t- z  f3 f/ g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) m6 F3 W6 r7 C8 P, }( ?# a
2 O( v! b' l  O' V8 l. L

' w, t6 Y) D# H+ ]+ y8 j  ~3 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-13 22:24 , Processed in 0.046044 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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