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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! `" e* ?& V0 o7 u0 K8 k6 f
  1. [code]EDMA sample test application+ z1 m% x7 V0 G2 \; }4 Y; T
  2. /*
    4 ~3 R8 R) c* R# C7 f  |
  3. * edma_test.c3 ?3 t/ L/ [6 I9 f1 p  ~# I( n
  4. *
    ' }. O; Z  O: X- [8 {6 u6 h
  5. * brief  EDMA3 Test Application6 H: c0 s" K- Z( u) j
  6. *9 K5 m8 h9 |3 R
  7. *   This file contains EDMA3 Test code.
    $ U3 s( P6 `( T3 b! k
  8. *
    . m! @. P* W, p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 w4 G( _; ^5 p! q2 Z% z: L( c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : J: ]5 ]: J  b; ^: p6 W4 K6 k
  11. *         TO CHANGE.
    $ }1 B! {6 f8 {% K' C5 c9 R. z
  12. *
    3 a, `/ p6 y+ v% r( O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' f' A3 \" G! A6 ~
  14. *( ]1 |! T1 X+ v: y7 Q
  15. * This program is free software; you can redistribute it and/or
    / K( h8 E- F+ i0 {
  16. * modify it under the terms of the GNU General Public License as: u) v2 L% F( {. \" K
  17. * published by the Free Software Foundation version 2.4 X* Q7 i# A. O, K6 |
  18. *& K0 ?, |/ K! \" P! m0 ~; j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% K8 J9 n4 ?1 `6 }
  20. * kind, whether express or implied; without even the implied warranty
    , v* k1 o" Z& m3 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - p% z, J" p5 _* k# [6 i
  22. * GNU General Public License for more details.3 K( q. A3 H7 M! Y) Z
  23. */
    ) e' q# r8 ~! |, q1 R% C& C$ [
  24. 2 C5 d! l. |/ P
  25. #include <linux/module.h>9 e7 O) F+ c# B( R
  26. #include <linux/init.h>* l# e' R* C$ [
  27. #include <linux/errno.h>6 X- W/ L4 c: \' a! R
  28. #include <linux/types.h>3 M  }& Q. V" |* N0 d
  29. #include <linux/interrupt.h>+ @. i5 x+ }6 M  l" ]( J& E  W
  30. #include <asm/io.h>& v/ G0 w* C. X0 V; R/ C  E" c
  31. #include <linux/moduleparam.h>
    ! J- }, h* f0 h* G) q
  32. #include <linux/sysctl.h>- G+ ]  }& o7 U; o
  33. #include <linux/mm.h>
    7 k  W: X# q8 u  I( Y, }  l
  34. #include <linux/dma-mapping.h>
    # g) j, Q6 J$ o( @
  35. ) Z; z8 `# M4 }4 I& O' z7 E0 P5 N9 |
  36. #include <mach/memory.h>2 ~% [3 }' _' P8 F+ Q) l
  37. #include <mach/hardware.h>0 l8 d2 {: |1 z; f7 a2 S
  38. #include <mach/irqs.h>+ u: Q) q; @  r% i
  39. #include <asm/hardware/edma.h>
    : p/ z3 b- ?9 M7 o

  40. 8 @6 H# m0 Z% I  ^
  41. #undef EDMA3_DEBUG
    9 k7 ]) ~) |  i7 d. U3 q
  42. /*#define EDMA3_DEBUG*/
    . R& s$ f- d7 v; C' ]7 e" i5 f
  43. 6 t9 f( n* l+ F% j
  44. #ifdef EDMA3_DEBUG7 v1 f- g( Y/ n# D' Z+ j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      U$ Z  z0 c4 X# ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W: a6 c4 o, R' A# x: ?, x/ E5 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ d& M9 Z  X6 G" h* f3 }! m7 C
  48. #else
    ( n7 ~' C4 ^. n
  49. #define DMA_PRINTK( x... )
    ! g. R9 p0 [4 L* }# T  f; v! P
  50. #define DMA_FN_IN
    ( q/ [# G" o5 m9 T' K0 @; H7 E
  51. #define DMA_FN_OUT
    + I* N- E9 e" C6 V
  52. #endif
    , D8 J. Y: B& }7 @/ H( v4 P
  53. 2 x. f' J' ~' {' K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 o( y* \, t2 M
  55. #define STATIC_SHIFT                3. S/ o' Q- @3 H
  56. #define TCINTEN_SHIFT               20
    & W; c' C  r) `/ `7 U% V4 ~1 a
  57. #define ITCINTEN_SHIFT              21& }7 [' w1 D; O% B' l. Q. ~
  58. #define TCCHEN_SHIFT                22
    2 V4 [0 d# u+ P2 K, S' N0 k
  59. #define ITCCHEN_SHIFT               233 y6 l: p; I) ^6 d7 q# F  f* r
  60. ) X4 j. g$ K* O& N
  61. static volatile int irqraised1 = 0;
    1 m5 v6 Y( Q8 I. x3 |+ e2 n+ w+ D1 O
  62. static volatile int irqraised2 = 0;9 r/ `4 A/ F: A$ W2 ?; Z4 r

  63. % N4 s) K$ V( B! \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 m, V0 a' H1 Q# y1 H, |5 y. O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c' I. B! F: L  d  ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R' N2 z4 c: R0 {5 d* M
  67. 0 ]! l9 R9 G! k- n( ~$ ~
  68. dma_addr_t dmaphyssrc1 = 0;& l, l$ \1 W9 t% b
  69. dma_addr_t dmaphyssrc2 = 0;9 _6 `+ x' h( O( R# d, d
  70. dma_addr_t dmaphysdest1 = 0;
    , ]! x& u. ]* J. s2 D0 k. q
  71. dma_addr_t dmaphysdest2 = 0;
    ! ?, z$ Z, w2 h# U9 g9 v

  72. . }# \% p- Q0 C( P' R  l" s
  73. char *dmabufsrc1 = NULL;
    - w8 w5 {+ [# z
  74. char *dmabufsrc2 = NULL;
    * X* g1 d8 P6 G3 P2 i& Y; K
  75. char *dmabufdest1 = NULL;
    . ^" c$ G: n6 y  y' D
  76. char *dmabufdest2 = NULL;  K9 J- S! J+ X8 T$ N

  77. ' P/ k4 w& K3 _4 F5 B
  78. static int acnt = 512;" R1 C, L+ f2 ?( \. O; b
  79. static int bcnt = 8;
    - w# ?4 f* h8 _+ D
  80. static int ccnt = 8;
    0 z3 V2 Y3 u  ?4 E5 f. m
  81. % S0 e4 L2 N2 a/ l; D; A
  82. module_param(acnt, int, S_IRUGO);
    $ u5 R% _1 ?' G' n9 z( L2 {3 g
  83. module_param(bcnt, int, S_IRUGO);) S, [: _  L4 u" T: ^3 |2 c$ h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& N3 A4 [8 [7 `

- x) k. }2 F  _2 S- \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% V8 p' p7 @6 Q6 g/ F" narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' m8 y# i  p+ T8 j9 @' G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Z  P+ m/ J- Q
( G! P$ h; L# y/ J7 N. b) r5 ^3 v# y! c# H6 _/ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 08:38 , Processed in 0.038546 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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