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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 U, o0 h" N" p  ^, z2 y
  1. [code]EDMA sample test application* \% }+ x% P! X% _9 g
  2. /*
    . f, o5 H1 X5 I/ B  C
  3. * edma_test.c0 v% y- T6 w, r8 O' Q
  4. *
    % _" W; p; V; f: `9 u6 A
  5. * brief  EDMA3 Test Application
    / B8 c! A8 S) }# i: y- E, o
  6. *
    1 m" y5 ?/ L# C5 Z8 \: g; b2 a
  7. *   This file contains EDMA3 Test code.  h; H4 q: b+ }! J
  8. *
    9 T8 Y$ v, M/ [# f5 \, ?, Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 a# J! }7 o3 U& u/ n) l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 M' P9 T8 P! I, s3 r+ V
  11. *         TO CHANGE." w. k) i8 v4 N6 x5 B: M  z4 j" D
  12. *
    ! I- X( ]) x* E: [0 p2 h- V& f+ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # a" d  v1 c0 R: X& u! p9 x8 N. D
  14. *
    8 K# q/ W- ^  c5 \) @8 y
  15. * This program is free software; you can redistribute it and/or
    $ {& K0 ^6 T" A3 k8 A
  16. * modify it under the terms of the GNU General Public License as
    7 s* G% L0 M1 g* S8 {2 w7 ?
  17. * published by the Free Software Foundation version 2./ x; j3 _0 T) t% |8 u
  18. *
    3 Z5 f8 i! I7 d" K! ~2 K+ W" x1 s9 q- W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J3 e3 d$ @; y2 Y- E7 b
  20. * kind, whether express or implied; without even the implied warranty' R3 ^: f5 x2 W1 s- @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& b# c# r& m' \2 R% ]2 L; N% `
  22. * GNU General Public License for more details.
    * a; r2 ~+ n! B, O% ~; x
  23. */& n/ L. Z" l" Q2 B; r+ [/ b( }
  24. 6 g- s: A. ?0 B% [6 l! F  ~  V+ _
  25. #include <linux/module.h>) n* D+ ]1 q5 Y. [/ U, F
  26. #include <linux/init.h>
    2 d6 _! U/ m2 u
  27. #include <linux/errno.h>
    " n* y! H0 f! o' U! o7 S
  28. #include <linux/types.h>9 P2 ?7 d2 H2 s& Z4 `5 s
  29. #include <linux/interrupt.h>) l( R0 e* |" Q; i' M
  30. #include <asm/io.h>
    3 i# z" N* j4 P- ^$ G
  31. #include <linux/moduleparam.h>
    2 t$ @3 L- ~0 m9 M. e
  32. #include <linux/sysctl.h>
    6 i+ A, e9 K& d2 e$ g6 o2 D0 m
  33. #include <linux/mm.h>
    0 h+ y+ @% K. z8 |
  34. #include <linux/dma-mapping.h>
    9 z& J1 b0 |# O9 C' l, A! v- o( l
  35. # R1 X- I: n/ x) H4 K. E% B: U
  36. #include <mach/memory.h>
    ! W$ J/ @# g% g: h3 N7 y* j
  37. #include <mach/hardware.h>- \5 k. U4 b. ?0 V; O' @/ `$ t2 e7 X
  38. #include <mach/irqs.h>
    5 o% s- z! C3 ?+ f: Z) T
  39. #include <asm/hardware/edma.h>
      L' s3 G1 p. O- r* A5 b
  40. + B; J' Y7 q. V+ n: ]
  41. #undef EDMA3_DEBUG$ L" U6 M' ]- R: k8 a0 E7 v; S2 E
  42. /*#define EDMA3_DEBUG*/
    : E9 @9 o2 @5 u0 N$ \
  43. 1 M# s; p* j7 W* |! ~5 ^
  44. #ifdef EDMA3_DEBUG
    4 k0 U9 w% M/ A" Z2 E6 h1 |/ |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : J7 N7 j8 i( p# t" _5 \4 z' c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # u2 V( y3 j! y+ E. u& p$ ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + z# Q' s: O5 l3 ?
  48. #else. M. o% D7 {6 i$ E
  49. #define DMA_PRINTK( x... )+ [) |4 t6 y7 g8 n# R
  50. #define DMA_FN_IN' R5 W7 ^5 r# s: f; F7 z
  51. #define DMA_FN_OUT
    7 A2 p0 N$ ?2 a+ e, v, N
  52. #endif
    5 u  f; M& |5 f+ s; M

  53. $ T0 I( }2 j% v9 Y2 K3 I$ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  M# T2 u0 E! u9 z* r2 k! O
  55. #define STATIC_SHIFT                3; U1 e. G0 p' z, H
  56. #define TCINTEN_SHIFT               205 X" Q& E/ X/ M2 W0 s8 t$ }
  57. #define ITCINTEN_SHIFT              21
    " Q6 n0 Q, ?6 j1 Q8 a
  58. #define TCCHEN_SHIFT                22& U! V. f/ q# p. m
  59. #define ITCCHEN_SHIFT               238 Y; C4 N. x# C9 `9 b. w
  60. 4 e9 p) P! ]% @; H( n- M
  61. static volatile int irqraised1 = 0;
    ; j$ F. n9 [2 f2 D) i- T( l
  62. static volatile int irqraised2 = 0;
    ( s0 C5 S/ [" `+ o+ y( }$ g4 M' Z0 |3 R
  63. 7 W5 g+ h/ X% a8 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 g: I" Q# {9 ?6 d# J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X, c. d+ o- C8 m& _7 A  M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" r9 E( J* h- Z" ~1 q& [0 U) G6 q
  67. $ A1 K1 M8 y; \' C% o
  68. dma_addr_t dmaphyssrc1 = 0;- A6 d$ m( _# v' o* B! E. Y
  69. dma_addr_t dmaphyssrc2 = 0;
    * g7 ?1 D- V, g  T! Q: w! X
  70. dma_addr_t dmaphysdest1 = 0;. e% R2 ]; V* L, i
  71. dma_addr_t dmaphysdest2 = 0;3 p4 H2 V. A9 N/ T9 z" a

  72. $ p. h: |9 {# y6 f, h, C
  73. char *dmabufsrc1 = NULL;
    9 {$ O: ?+ c9 N5 y* I# n" P
  74. char *dmabufsrc2 = NULL;+ @# Q. g' E: m$ F/ k: P$ t
  75. char *dmabufdest1 = NULL;
    ! M2 k1 [/ Q# s/ Q4 {/ [
  76. char *dmabufdest2 = NULL;
    & Z" k- k4 i5 L
  77. 1 D3 J* f  Y4 Z- I4 C; m: f1 a- X
  78. static int acnt = 512;
    2 P4 J1 y& K0 _/ q! B+ s
  79. static int bcnt = 8;
    9 ?" j1 j# O7 u  z0 f8 Q# U# {- I
  80. static int ccnt = 8;
    9 M( b9 v4 B- D3 ]- o8 _8 s$ _8 y

  81. & c7 F2 L7 {6 _* M, a( N
  82. module_param(acnt, int, S_IRUGO);
    / z3 D  a( i6 g3 z* U$ K
  83. module_param(bcnt, int, S_IRUGO);
    % v$ e: B! V; t2 o: }( g8 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( @  A. i+ F: O) X& l/ N
6 c8 @$ p, e, h* P1 B- Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  o. D) e/ y  S0 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, I' y+ y+ s0 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [2 Q# v( [/ A3 U: L  q5 p  F. O8 x' N, \0 u, _( Y' j5 J4 W
3 z) B- ~" D: j! @( s' u: Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 06:21 , Processed in 0.037903 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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