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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 o' N2 b8 Z! ~- c0 w! r" Y
  1. [code]EDMA sample test application. p1 ]/ G- `; |; o, p& P% {# x
  2. /*$ j! {" I2 K0 G. z- @
  3. * edma_test.c
    ( I# I8 @& x- r  Y
  4. *3 V1 k; E1 x  ~, x  y% O
  5. * brief  EDMA3 Test Application
    0 l$ v- C& w2 d
  6. *! X" y6 q6 k3 m. ?
  7. *   This file contains EDMA3 Test code.
    1 I9 _4 z; ^5 k' z& y
  8. *
    : s! y' Z! F% w7 D" x; E& K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: {4 `! ~& d' @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , t% w- D! l  ]2 H1 S% Y( P# b2 k
  11. *         TO CHANGE.# _5 Y; C2 ]# k6 z. k; }4 E
  12. *
    : c/ q4 s. V6 M; x# F* f# Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 Z7 e, o1 b* o# |2 O
  14. *
    * P' u% ]1 c% @- H5 G
  15. * This program is free software; you can redistribute it and/or
    , L$ D& B( S+ [0 a# O
  16. * modify it under the terms of the GNU General Public License as$ F- r3 y5 Y/ ^/ r
  17. * published by the Free Software Foundation version 2.
    5 x( ]1 E! K" A: l: p0 [( l+ @
  18. ** {( S9 y; F1 k. N. Q3 f, p9 k$ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , v- g  {& p2 P9 k) Y0 Q9 C, n
  20. * kind, whether express or implied; without even the implied warranty
    1 V" x( B0 D5 F: v' P1 P( v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( I# M4 A0 l$ T) v' a+ K7 |- F# _
  22. * GNU General Public License for more details.) W3 B% E4 ^: f! q5 w3 M* l
  23. */
    / {) L9 d2 q# n
  24. & I% Z5 }' L4 \( I
  25. #include <linux/module.h>
    1 W3 Q4 k1 l. P2 h1 {
  26. #include <linux/init.h>
    4 l' S  `( f& r5 j" {( F
  27. #include <linux/errno.h>
    8 ?9 v8 K! J' O0 P: X. O
  28. #include <linux/types.h>! p( O5 l+ |1 k
  29. #include <linux/interrupt.h>" b5 c8 ~8 c( f0 f
  30. #include <asm/io.h>
    1 x& s: Q* _3 G7 Y
  31. #include <linux/moduleparam.h>
    $ h  T' B6 N% ?  m% T
  32. #include <linux/sysctl.h>
    8 o$ W& B  ~% q* k. \
  33. #include <linux/mm.h>
    ) h' j. Y) s- B- I' w
  34. #include <linux/dma-mapping.h>3 g1 s/ }# s  A: A: M3 m

  35. ) j2 f+ s1 [2 E! a# S
  36. #include <mach/memory.h>
    1 N, M. o, r  d5 c' }8 {
  37. #include <mach/hardware.h>6 ]; l9 U, H, Z& o+ e
  38. #include <mach/irqs.h>
    1 B- s/ U- u! S5 a: ?
  39. #include <asm/hardware/edma.h>
    ( G+ z+ p2 D% M/ [" L* a
  40. - s" F# U0 L( c6 t% M  X
  41. #undef EDMA3_DEBUG. N# \1 P3 `) w, y* _
  42. /*#define EDMA3_DEBUG*/# Y  c( A6 E- B* q4 {  o$ g& l
  43. % a2 z3 r! Z$ c$ K
  44. #ifdef EDMA3_DEBUG
    - J" q5 M1 ~/ E& C( [, u& p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). \' Y! w6 A( i5 C& p" X2 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Y: M6 Z1 x+ B/ {4 V" S5 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 O- Y8 _- \# I! B: ?) O
  48. #else2 O' ^4 ~) ]4 _8 l* G6 w
  49. #define DMA_PRINTK( x... )
    6 R! [- b' f/ R: ~0 s
  50. #define DMA_FN_IN
    8 j; B1 s5 E0 a
  51. #define DMA_FN_OUT
    5 |3 q2 }; i% i9 Y* z2 Y* W; O" x
  52. #endif
      G2 Y2 e0 [: J: o9 T4 u, e
  53. + e+ x8 o9 i2 _5 b- U4 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 G* E3 q6 H/ b, X3 O' v0 `* |5 F2 i
  55. #define STATIC_SHIFT                3$ l  S6 R* z9 Y1 u5 q& \6 Z4 T
  56. #define TCINTEN_SHIFT               20. l  r3 u, `; Q1 p9 y
  57. #define ITCINTEN_SHIFT              21% Q/ C2 r$ K+ }* b8 o* Z+ ^' E: Z' R, M
  58. #define TCCHEN_SHIFT                22# y5 G9 F8 ^$ N4 W4 D/ K
  59. #define ITCCHEN_SHIFT               23* r$ p2 e/ p4 q5 T& X3 q: s
  60. 3 z. Z( g/ w6 r3 a5 F+ `
  61. static volatile int irqraised1 = 0;
    - f9 C) m7 j1 ?* J9 _: {+ P
  62. static volatile int irqraised2 = 0;
    2 W3 b0 r+ F- ^9 Z* D
  63. 2 M* _' i9 }! \) l* U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; w  ~) ^6 b/ u0 }' K, J  ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ j* w5 B$ q& H$ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; J+ I  Y5 Q' j/ s& z$ b
  67. ( |( Y- b2 D5 w1 `) h1 J
  68. dma_addr_t dmaphyssrc1 = 0;
    & d7 a8 w$ F  O. Z3 ]
  69. dma_addr_t dmaphyssrc2 = 0;; B2 h2 w1 D2 K4 f. A1 z; I
  70. dma_addr_t dmaphysdest1 = 0;
    : l, l0 f' x$ {# A7 n% B
  71. dma_addr_t dmaphysdest2 = 0;
    , x" k( a) ]* h2 Y7 e7 j7 B& _8 v
  72. 9 X% k5 V7 u9 R0 K* S( L  d$ B1 E
  73. char *dmabufsrc1 = NULL;* F, K/ c* z- I( f5 j
  74. char *dmabufsrc2 = NULL;4 i7 y) p2 t' T. k, [2 i! L$ O4 x+ ^
  75. char *dmabufdest1 = NULL;% F" X7 h6 ?2 ]2 y$ c
  76. char *dmabufdest2 = NULL;
    ( T- q: M1 u1 l8 f) H  H  H& p% L
  77.   E4 h: C0 S! ]- a% J$ `3 T+ o
  78. static int acnt = 512;* `! U# N. n; T" n
  79. static int bcnt = 8;
    7 I& ~. U4 C8 J6 W% G/ Z) Q) c4 U
  80. static int ccnt = 8;4 W, u8 C, z6 l0 i, J5 N4 g% F

  81. ; h8 g  B9 |4 B3 N; |3 b  A
  82. module_param(acnt, int, S_IRUGO);
    , t3 W% f8 ?; m. M/ d7 M
  83. module_param(bcnt, int, S_IRUGO);
      `+ B0 ^2 t+ `+ ~. G4 y) \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* _& Y) m8 o9 C8 r+ F
6 ?: j' j% S* i& b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ^0 r' v6 o: u4 ?$ @5 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ M7 t7 Y% x5 e5 f2 c3 n8 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 |, M1 P9 ]8 ~: q  n( Q
2 m% l$ q- [) _- r, V
. l2 [+ `" f/ B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 22:47 , Processed in 0.043584 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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