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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 B) i+ C" S3 u
  1. [code]EDMA sample test application6 ~+ k8 H. x9 \# X7 R
  2. /*7 M: m8 Z" ~! |
  3. * edma_test.c& Q0 y5 U2 ]/ y' r. M
  4. *
    4 o7 @- V- Z! B+ D
  5. * brief  EDMA3 Test Application0 v7 t' N8 [% ~3 L9 K
  6. *, F5 g8 F( r$ Q" D+ v! n: s' l
  7. *   This file contains EDMA3 Test code.: i+ e$ z) Z9 J9 \  y
  8. *" I2 ]+ C# F" P2 h( D6 j3 h8 h; X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + L5 d- I5 l) k: T; ^# G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  Y8 T! c% b3 G3 _  G
  11. *         TO CHANGE., p  C, A& Q  f( @- _3 k8 S
  12. *' n. O! O/ c. ]" a' ~- `0 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 u$ F: u) h2 y5 [7 i* S, Q1 Q  ?/ [
  14. *
    , z8 \  K( Z& k$ T& ?! V
  15. * This program is free software; you can redistribute it and/or
    4 M; A6 M/ f; ^$ m, M. Z
  16. * modify it under the terms of the GNU General Public License as
    ( U2 Y7 [7 ]( K  a) j% v' q0 \5 S
  17. * published by the Free Software Foundation version 2.9 F$ U- P0 z: @
  18. *" f8 n- G$ B/ D5 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Y" x6 R# \1 T& P+ G, w
  20. * kind, whether express or implied; without even the implied warranty
    " `( P1 O9 n( `8 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 g. E7 @  X+ r# p5 s
  22. * GNU General Public License for more details.
    ; q. G  @4 T6 _! B+ B
  23. *// j: e" r2 a% i9 ^+ X1 N

  24. 3 L: T9 r5 j6 [* K4 h
  25. #include <linux/module.h>! j2 E/ y5 O% q7 A! H+ U4 j
  26. #include <linux/init.h>
    " m3 ?1 H& O8 n9 x( ^. n
  27. #include <linux/errno.h>
      @4 h- C+ P. }. F6 f+ a6 ]* q$ M' f
  28. #include <linux/types.h>
    0 F5 ~  @" Y3 N' N9 `
  29. #include <linux/interrupt.h>
    * o/ w; Y3 n: t0 Z+ u
  30. #include <asm/io.h>; f4 n' k! N& V0 F) K
  31. #include <linux/moduleparam.h>
    ) ^% O: X7 w& g* P  {$ c# N
  32. #include <linux/sysctl.h>
    ' Y4 X* _  ]8 s# u7 i( f
  33. #include <linux/mm.h>
    ; k: b0 a. T3 Y; c( f
  34. #include <linux/dma-mapping.h>0 f' F  K& B# E8 `2 g

  35. " J* M$ ?! a/ b+ l$ H
  36. #include <mach/memory.h>- J. c3 V  G* F' [0 `; u
  37. #include <mach/hardware.h>6 i( O+ s9 S3 `" k/ k
  38. #include <mach/irqs.h>/ {4 Y  \" {% Y1 P9 B
  39. #include <asm/hardware/edma.h>4 Q3 @4 `" ]$ |4 X

  40. * @5 n2 f$ Z* @5 M+ l
  41. #undef EDMA3_DEBUG# S4 D( P: m8 s& i# M5 ]
  42. /*#define EDMA3_DEBUG*/* k4 V5 B$ u, u, M; O
  43. 3 v3 r8 Y: }; D* f7 w6 c2 H6 L
  44. #ifdef EDMA3_DEBUG
    3 v9 I% n2 d# J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y$ @6 B, @! U; T* I3 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  ~4 i& N# J6 ?( A& p0 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ q: C$ l3 w* ]/ R
  48. #else
      ^" R( |- p4 K6 l4 k" F. z$ ]1 z
  49. #define DMA_PRINTK( x... )$ c& d  L' k4 I! z' W! n
  50. #define DMA_FN_IN
    5 r! G5 V. L# w1 z4 f
  51. #define DMA_FN_OUT! Z# n$ |0 Z4 |1 S9 ]
  52. #endif
      W8 ~$ r9 ?( }! X1 [' h; J& P
  53. . f3 d) _3 g6 L1 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). Q& [6 z3 e8 {, ]" B( e
  55. #define STATIC_SHIFT                3
    6 @3 w9 c+ L$ [8 m6 f
  56. #define TCINTEN_SHIFT               20
    4 w# q! w% Z7 G
  57. #define ITCINTEN_SHIFT              21
    5 H9 [' V$ x+ A# z: Y$ o" h. V, k; B
  58. #define TCCHEN_SHIFT                22
    0 ^7 l( B' e0 |0 C
  59. #define ITCCHEN_SHIFT               23+ O8 @# p3 r  [, j2 w5 p5 V
  60. 6 @' p! O: O+ Y" I) A# N+ E
  61. static volatile int irqraised1 = 0;& k' N' }0 |3 m; m/ s( t
  62. static volatile int irqraised2 = 0;
    % p7 L* x7 d9 U" ^8 u8 r
  63. : A$ h! i% ^. b5 [3 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 u* D1 f5 r) K. D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ]* d, Y8 q/ [* C: {" N- ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' P, b+ _" m: q+ `

  67. 2 a) v0 B) l( O0 x. w
  68. dma_addr_t dmaphyssrc1 = 0;# Y6 K; _" P( d% C
  69. dma_addr_t dmaphyssrc2 = 0;
    3 I7 |1 J  Z3 x* Z" ]
  70. dma_addr_t dmaphysdest1 = 0;
    & l2 P/ B- }2 j4 R2 ]8 g' w. e: z
  71. dma_addr_t dmaphysdest2 = 0;
    , o1 g! {  w/ N% H
  72. $ Q9 O3 d; t) O  n: L# R: N
  73. char *dmabufsrc1 = NULL;
    0 q' u. S. P  K" X  h& S
  74. char *dmabufsrc2 = NULL;9 Z4 K) e5 Z3 Q& s* Q
  75. char *dmabufdest1 = NULL;
    + K4 q' I* B6 Q# e& t
  76. char *dmabufdest2 = NULL;
    6 B2 h& e0 ^1 o0 R; G# r- w  H

  77. 7 O6 P' B0 P/ a1 v2 O, i4 D5 D
  78. static int acnt = 512;
    * ~/ Y* ?: o* I; \
  79. static int bcnt = 8;
    6 P$ i7 J, e9 T* F
  80. static int ccnt = 8;
      `$ `# [" m1 Y: r" B& u& K* E
  81. ' X# ]  q) D' }' b1 v5 |% J
  82. module_param(acnt, int, S_IRUGO);# [& e+ w" J5 X# W, q4 g8 Q$ G
  83. module_param(bcnt, int, S_IRUGO);$ b" \: j: A6 r6 B: x) U+ j% _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ e( X$ p. I4 h0 J+ i2 [0 p; A# X& C3 g2 \, S$ J4 A! J! C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 h+ T0 ^2 X7 G$ i" L* ?# ]% T
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 P+ `3 K6 w, _& T8 U8 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  R+ d8 D& o& P8 S( w' V% c
+ \* `  {. {) v. B

* t, C9 K, Y) Q# C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-6 00:12 , Processed in 0.041221 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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