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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 o7 C1 q9 I" G8 S# f
  1. [code]EDMA sample test application
    1 u1 D+ J& g6 N7 W& G* q+ H5 E' T
  2. /*
    / _- l, ?$ H; D: m; S+ ^
  3. * edma_test.c+ l, T% X; l: p
  4. *  H: S$ A* K, s4 l1 r9 b
  5. * brief  EDMA3 Test Application
      z& h5 `" k: G" k; Z
  6. *
    ( g+ U8 |) F! D! l1 w- T( A
  7. *   This file contains EDMA3 Test code.
    3 s  q: y% H2 M+ Y
  8. *
    3 t0 j5 O: a% M+ M- e) f9 X" w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% [0 @# \) W" b- M' J4 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # z, W/ Y1 T1 ?- K
  11. *         TO CHANGE.
    ) d, g# v7 e6 N% i0 ^& X4 f" D- a
  12. *2 O# Q8 X8 s7 R$ d( y% g. k1 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; T) f! A5 n3 T
  14. *# h' V! M& O) n( D6 _3 Z7 }  w, w
  15. * This program is free software; you can redistribute it and/or8 C" L: m/ F8 P( e; j  O7 `
  16. * modify it under the terms of the GNU General Public License as
    6 \( c" T0 a9 x; Q6 P2 V9 g
  17. * published by the Free Software Foundation version 2.
    $ l# Q7 v& K% A4 s, m, B
  18. *
    : Q/ f9 m+ M0 e' r5 E1 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      R" Q7 ~" \2 W; E" W
  20. * kind, whether express or implied; without even the implied warranty  p2 `  @7 ?8 W6 U( @$ }' g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% L$ _0 \2 H# I# n& g1 s  P! }6 S
  22. * GNU General Public License for more details.
    ; r+ }. t1 I5 w; q$ Y* q$ s9 E  a& `" c
  23. */7 L* i; j$ i: y& m, U0 z

  24. . i7 ]- H$ j% z* q1 k
  25. #include <linux/module.h>' S& y( N0 _+ ]+ s. r, S( m* c/ X
  26. #include <linux/init.h>
    - ^% b) S+ |$ @' \% {3 F
  27. #include <linux/errno.h>
    8 E- z) U- C8 x7 y
  28. #include <linux/types.h>
    0 ?, }! s- u4 I- {0 s* T
  29. #include <linux/interrupt.h>9 U' t/ z6 I# H: X0 S
  30. #include <asm/io.h>
    " a' d. U2 W/ O( D3 c2 O. b3 ?
  31. #include <linux/moduleparam.h>
      E( n" Z7 y* d/ |' U
  32. #include <linux/sysctl.h>0 r% ]5 i) r& A$ C6 b
  33. #include <linux/mm.h>
    3 j3 ~: k' U6 _  N7 r; X
  34. #include <linux/dma-mapping.h>* Q# d+ u3 h& e) t8 r9 I

  35. 3 ?8 N" M+ L' F) j$ X
  36. #include <mach/memory.h>
    4 ?6 C4 r" B8 r7 k; J( p  j: ~. }
  37. #include <mach/hardware.h>
    + ~' R$ R$ _2 D# g$ q& o$ ?8 C
  38. #include <mach/irqs.h>3 |7 |  x7 G/ a# ~" k
  39. #include <asm/hardware/edma.h>
    : d# d) c$ t" s9 b& ]  ^4 A
  40. * N7 o" f: j0 y  I5 f' N( j& o$ m5 b4 W
  41. #undef EDMA3_DEBUG
    % h' u( Z, f! D) `9 X
  42. /*#define EDMA3_DEBUG*/
    2 W) C; K- S* X9 p( f0 T7 R
  43. , H; q( V, ?' f0 W$ K) j4 v
  44. #ifdef EDMA3_DEBUG
    , D1 ]& I$ |! @- ^7 f6 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + O6 f0 k6 R5 h/ d/ ?9 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ E/ I2 M% r* s' K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 p6 o4 D8 u1 C! S* s9 F3 L
  48. #else
    ! C( R# v+ y$ ^# r$ j' u0 \
  49. #define DMA_PRINTK( x... )
    : r( Z3 U3 d4 |: a# @9 K& J+ a9 S7 p7 [
  50. #define DMA_FN_IN
    , o# ]% _7 `; H8 M% j4 `
  51. #define DMA_FN_OUT7 b2 V2 _+ {( _: y
  52. #endif, \" T  H# v) Z+ R
  53. % k* k7 X2 U' V0 R% w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " u5 H, a' W! R# w( f) u
  55. #define STATIC_SHIFT                3
    0 o5 O6 ?7 ]+ z& J' g
  56. #define TCINTEN_SHIFT               20+ S8 x+ w# R% l. m) }3 |" \5 @! S
  57. #define ITCINTEN_SHIFT              21
    7 j" r4 b! E2 E! M9 }; \
  58. #define TCCHEN_SHIFT                22+ R, E$ b+ P1 w
  59. #define ITCCHEN_SHIFT               23" V) S( r6 K8 e6 ]' l1 N$ O6 v
  60. , `2 Z3 v- L4 P" s6 s. `; |
  61. static volatile int irqraised1 = 0;
    ! W- {; L/ @; g( S1 s2 f, S$ c
  62. static volatile int irqraised2 = 0;
    ; a- ?# a; E% G$ A

  63. 3 ^. W3 v" w: r) L: S; r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      W+ |% \, E/ v# b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 r: |3 ]! I. z, o9 I' [& W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U  O8 R! A" J4 i9 `
  67. * e0 O5 Z9 N( w9 ?7 q1 y# D5 E0 a
  68. dma_addr_t dmaphyssrc1 = 0;
    " O' c6 U+ i' l7 }/ u) A+ R
  69. dma_addr_t dmaphyssrc2 = 0;
    1 @* ~; s  D' G
  70. dma_addr_t dmaphysdest1 = 0;& o+ p% Q0 z5 A( D
  71. dma_addr_t dmaphysdest2 = 0;) w: L: X$ h% Y

  72. ( h$ U% j8 x1 U/ E- S0 l5 H
  73. char *dmabufsrc1 = NULL;9 T4 p( U5 ]3 o3 t2 T% }  ?
  74. char *dmabufsrc2 = NULL;* O7 |( D' W  f, P; v
  75. char *dmabufdest1 = NULL;  ]. g6 E9 E; w% W" G& U3 L
  76. char *dmabufdest2 = NULL;
    2 G2 O) U- ^6 q2 R1 @
  77. # P$ R6 S7 e' |% |! F  e
  78. static int acnt = 512;
    # z* m/ ~2 w4 n. \8 y8 ~" N8 w1 v
  79. static int bcnt = 8;# _% j, T  a. A; M- m
  80. static int ccnt = 8;2 K: h0 [% R3 D* v! N; N

  81.   V1 v' n7 G- x& Y4 W: \- ^: f2 T3 e% `
  82. module_param(acnt, int, S_IRUGO);4 A8 j" |, Y2 k) \: L, W# _
  83. module_param(bcnt, int, S_IRUGO);( t$ P8 O- s9 `" X" f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 Z$ G8 z1 y9 D! Q. l! T6 o$ f! @. e: _7 q3 {4 Y3 t1 m; t' V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- S( K1 Y" n5 b- q) s# O+ V+ Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ B* {2 u$ {5 N/ g) b: ~. F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ ^# T. _+ w9 C
. s+ f: X  G) y
8 m) n# K6 J  f. i5 A0 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 15:09 , Processed in 0.040232 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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