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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q2 N% ^! ?8 [0 [* b8 \. d: j
  1. [code]EDMA sample test application
    0 X8 k: ~  {* J( A; P# t4 w
  2. /*
    ) }, @# Q4 Y% ^4 f. z3 `: U0 }
  3. * edma_test.c' E; p2 z- n1 N" H# B
  4. *" @2 f: l5 A# z# k5 o
  5. * brief  EDMA3 Test Application: X, ~' i! |+ Y% @
  6. *
    % Y! Q) L' ^# |* I) w: ]( ]7 R
  7. *   This file contains EDMA3 Test code.
    0 z# X$ |& N7 f4 ~8 u7 K
  8. *
    2 A& M( x" w/ b+ T  A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: ^( \% _  S( e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; O9 k6 l! K5 m" |* m
  11. *         TO CHANGE.9 Q8 d% `: B/ f
  12. *$ C* \6 a) c3 U5 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( t  ]. i7 ~5 J# U( H& C. f
  14. *. v1 b4 j! W' R9 W: L, v
  15. * This program is free software; you can redistribute it and/or$ c) g; ?  d* {$ M
  16. * modify it under the terms of the GNU General Public License as
    . L2 V, w( O' f5 D. f' G0 v
  17. * published by the Free Software Foundation version 2.
    5 w. [& `% l: }& [) G3 V! x7 E: k
  18. ** O8 o" s) `0 f) K5 B8 ^: j4 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ {7 N1 ]# Y) e: r. v! X
  20. * kind, whether express or implied; without even the implied warranty
    / ~8 Z$ E9 H% ^2 `$ ~' g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - ~: c6 L  U, y3 [2 A
  22. * GNU General Public License for more details.
    + X4 ]7 [: h$ c1 ]$ b; ^3 ^# e
  23. */) m$ L" m  N0 \7 Y  S2 S" p5 ~; r
  24. ; l4 p7 ^% V( y+ L' b" }
  25. #include <linux/module.h>5 l7 \& A2 b0 v
  26. #include <linux/init.h>
    8 l& i1 b- `9 O7 W3 A$ g
  27. #include <linux/errno.h>
    % D- Y- ~" S% P( A
  28. #include <linux/types.h>
    + M& K: p4 r& H- O
  29. #include <linux/interrupt.h>9 X; s8 H  k) }8 O! I' R1 B( `9 N
  30. #include <asm/io.h>4 J4 U" K3 o6 ~7 H- p. e  a1 N
  31. #include <linux/moduleparam.h>9 J8 S! z2 ^7 h$ w& f
  32. #include <linux/sysctl.h>, F' ]" O, ]1 q0 B, I6 |
  33. #include <linux/mm.h>
    2 C3 G2 ^6 _& ?$ B
  34. #include <linux/dma-mapping.h>* Y( y; i  Y$ O) m9 j* |9 R

  35. , @* ^8 _( U  [
  36. #include <mach/memory.h>
    & }5 M- x* l/ \% Z
  37. #include <mach/hardware.h>% y+ Z; b; W! v! z/ E( P! t
  38. #include <mach/irqs.h>
    ' ~9 o1 U2 _8 V
  39. #include <asm/hardware/edma.h>
    $ q# d' L6 P7 O) O- W

  40.   h1 [$ h1 u6 |5 E* `# u5 u% e
  41. #undef EDMA3_DEBUG( A4 }1 S: w+ P9 @
  42. /*#define EDMA3_DEBUG*/" }% I; r+ ~6 O7 z* b0 c8 w

  43. 2 F' i/ x, L0 ]+ @. y
  44. #ifdef EDMA3_DEBUG$ {" Z6 f1 `1 @0 ]' Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 g$ O. v$ P& D- H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % c4 y- ?/ [( j4 ]& L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 ~. h" x4 j% z) \
  48. #else! e& e6 [; K2 J
  49. #define DMA_PRINTK( x... )( R1 M% ?; x  d$ _% _" {: O
  50. #define DMA_FN_IN/ ~/ a1 ]/ i7 I' l
  51. #define DMA_FN_OUT4 y, ?% K  D& a  J, V0 g5 v7 X9 s1 j
  52. #endif) S9 O- B* C6 {8 n) s6 @
  53. , g7 J- s  u% r# G* u3 Z& {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* P* q7 w) @- _+ m, V- L
  55. #define STATIC_SHIFT                3
    ( D- G* B( h4 a* w9 A5 n
  56. #define TCINTEN_SHIFT               20
    6 ]" I: H0 z5 p( s* J/ g
  57. #define ITCINTEN_SHIFT              21
    # n+ q+ j" Y% N2 [0 v5 \" F
  58. #define TCCHEN_SHIFT                22' ^0 c) B6 |" C# {* m4 @
  59. #define ITCCHEN_SHIFT               238 f: D- }1 G1 Q0 K' V3 j: |  y+ ?

  60. ' @6 R( p) _+ J, ^- R( ?
  61. static volatile int irqraised1 = 0;/ F# B$ X" S( Y) M8 z' x
  62. static volatile int irqraised2 = 0;
    9 h' Q" P; q; I7 C& D" ~

  63. % X9 |- E4 p9 @, B7 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {  x/ x( w+ W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ^9 \! N# t, p# W# j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [* K2 `+ M6 I, r6 `

  67. / r4 c! d9 {# J6 z# }  g6 x  ?
  68. dma_addr_t dmaphyssrc1 = 0;8 m- s- k! i6 P2 k) ^
  69. dma_addr_t dmaphyssrc2 = 0;) b/ e/ ^6 F2 }8 R2 p
  70. dma_addr_t dmaphysdest1 = 0;
    5 z; f: h& q5 h! R
  71. dma_addr_t dmaphysdest2 = 0;: A# a* Y6 v1 m6 Q! M* B  \, o- c0 n
  72. : g) H2 t; D" M9 R# s+ u
  73. char *dmabufsrc1 = NULL;
    ; A! B* f$ Q7 u: [! Y1 W5 {
  74. char *dmabufsrc2 = NULL;' g) T, z6 x; j& @# ?
  75. char *dmabufdest1 = NULL;6 \0 I5 z  z3 \
  76. char *dmabufdest2 = NULL;
    $ H! _4 j7 V# V# e/ [0 u/ R
  77. " i* C7 p9 B0 O, }% X$ P4 p
  78. static int acnt = 512;
    . O3 N2 z1 Z$ T2 ?: ~$ B" X
  79. static int bcnt = 8;6 v5 i, }4 r; h; b: a: k& `) Q0 O/ g
  80. static int ccnt = 8;
    ) l% `1 A6 r5 p8 u0 U! d8 X( D* d' s

  81. . D3 s7 p" `- r) }: R) Y
  82. module_param(acnt, int, S_IRUGO);0 z8 g- Q$ Z0 @6 e# V+ B4 N' a
  83. module_param(bcnt, int, S_IRUGO);! A3 [, S! ~" j# i6 H& N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; V! |+ t* X- s4 `
" l/ E" Z( }3 X) r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  n- n, _; H# e) o$ Y& l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ^/ C# c2 g# [4 F  O* J# w( S8 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& ?1 D/ J* i2 v9 q* k4 |

$ p" k6 _# c! A' c! B5 q. _. T" F/ A* I. z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 13:41 , Processed in 0.043097 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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