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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : X+ K1 O% _8 ]) ]
  1. [code]EDMA sample test application  t) N% y$ {# }/ V" M
  2. /*, p' z+ I! O2 t% u& h
  3. * edma_test.c
    " u4 K$ N+ S5 H& c! c2 A
  4. *
    : ~8 I( s5 k; _5 T. r' v# t% ^
  5. * brief  EDMA3 Test Application% g% ?' F5 D% v  a
  6. *8 J/ w* x5 d' k; A
  7. *   This file contains EDMA3 Test code.
    " ?* t6 V9 k: w# H/ d% C+ F
  8. *- l/ E0 r4 p  i, [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 c& |( i; E; y: @: S5 ]5 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ K/ Y" \. X1 _6 P1 p  {! y) R
  11. *         TO CHANGE.- J) e9 k! h! h' m3 C$ j
  12. */ u; P5 z! o( B7 \2 Q. K- l4 |$ g; i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 m* }% N( ?9 F4 z& t" D: O
  14. *& R6 Y. ^" H$ v' _) X" Q
  15. * This program is free software; you can redistribute it and/or0 Z, c0 S, d: V# |3 F7 y
  16. * modify it under the terms of the GNU General Public License as: S4 |3 K5 l4 c" [; }; R6 ?
  17. * published by the Free Software Foundation version 2.
    5 Q, W: r" M0 o9 D0 x' R
  18. *4 J' D7 A' c" i9 t) d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" X5 i. ?* Z+ k/ v
  20. * kind, whether express or implied; without even the implied warranty
    2 F  y4 U% d) p& @9 [! k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' c; M0 _5 N+ E) @6 o- r' a. I
  22. * GNU General Public License for more details.+ A& \1 p- ~$ r& W. [1 k
  23. */
    8 E5 ^+ j% E  Q: O

  24. ( q/ E. |& ?! I  n) o1 _
  25. #include <linux/module.h>: Z% o) i0 z. L5 x
  26. #include <linux/init.h>* M; C9 W+ P5 l+ b+ m& O
  27. #include <linux/errno.h>
    * q- m% _" }  `$ @8 Y+ ?( v
  28. #include <linux/types.h>+ b/ X3 {  |3 M, O3 x& T3 G! K9 U$ U
  29. #include <linux/interrupt.h>
    4 U, i0 G9 @8 O5 P' @$ x
  30. #include <asm/io.h>
    ( V/ n/ t+ D/ i: H- E
  31. #include <linux/moduleparam.h>7 h$ a2 I0 x8 \' U# J. ?$ n" A! _
  32. #include <linux/sysctl.h>
    : a1 i, U2 r7 T1 b) b, H/ Y% P
  33. #include <linux/mm.h>
    ( U) x5 q7 l; r% k8 W
  34. #include <linux/dma-mapping.h>
    : x9 p2 W4 D" z+ `/ x: O) p
  35. 0 ?7 o9 U9 d+ m3 ]& \
  36. #include <mach/memory.h>0 _. |; c/ \4 D1 H3 |* a4 P0 U
  37. #include <mach/hardware.h>
    8 z3 ?/ `, q0 g0 ~
  38. #include <mach/irqs.h>/ N5 _* Z0 ~* o" |; M+ k# e# V) P- ^
  39. #include <asm/hardware/edma.h>) q: A" i9 h  l/ k
  40. 2 q% ^9 i, q  @
  41. #undef EDMA3_DEBUG
    1 O- e& Q3 D# A0 Y
  42. /*#define EDMA3_DEBUG*/
    9 ^) E5 D3 r$ U1 d# l

  43. ' N7 G2 J- s: y8 C
  44. #ifdef EDMA3_DEBUG$ s5 ~2 Y; y! h5 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* I, b  J  p4 z) H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( [! o! s0 i. z5 E  H; ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- |$ _- D# U& H; W+ v: ~; X
  48. #else
    8 H+ ?- O. M3 s4 k$ ]4 \- @* s
  49. #define DMA_PRINTK( x... )
    ; T. Q& F9 Q7 m! J5 M# n8 g% J3 f4 f  O
  50. #define DMA_FN_IN- u0 ]; g: ?' |
  51. #define DMA_FN_OUT
    : m2 ^* R" d. y# _: u
  52. #endif
    " V( w% d( U& l: V. b; z
  53. & D# p1 O  e% A3 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* u: w& h1 O, u, V: @  \) Z- @
  55. #define STATIC_SHIFT                3  h7 ^, Z  n2 V& c
  56. #define TCINTEN_SHIFT               20& B" O! u) w! v; F; ~' Y# R
  57. #define ITCINTEN_SHIFT              21
    . O6 B0 j' c4 s- h  q
  58. #define TCCHEN_SHIFT                22
      {/ ]1 _! ]1 w; |5 \- g0 c+ |
  59. #define ITCCHEN_SHIFT               231 y+ i% P; I6 D! e5 j3 E) ?

  60. 7 L* T& Q3 g9 X# ~/ f
  61. static volatile int irqraised1 = 0;. a4 w6 w3 F, z' x; |# }* J
  62. static volatile int irqraised2 = 0;- A$ j, E) u8 F$ C) H, G

  63. 0 S1 s* H. G  _" ?* e% O! e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( p8 Q, [5 |; B0 z8 d7 h2 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ~6 u8 q* M5 |$ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( D  x2 e5 k. _  c- _

  67. $ ]* j! X8 z5 i' w
  68. dma_addr_t dmaphyssrc1 = 0;
    $ [8 ?. d" {3 g3 Y1 U$ t3 l4 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    % c: l! l; ]6 ^2 R, I9 d, c# k
  70. dma_addr_t dmaphysdest1 = 0;. Y4 G' j  I; K  o! p
  71. dma_addr_t dmaphysdest2 = 0;
    # L; Z2 J+ ?( _/ j  N

  72. 3 R# B0 V, T7 p; T+ k7 _
  73. char *dmabufsrc1 = NULL;- _* E6 ^* s% `
  74. char *dmabufsrc2 = NULL;4 T( C. i( l& T9 i7 _8 r+ Q. ~/ f8 ^
  75. char *dmabufdest1 = NULL;% d+ u" E2 [( W" B, G1 [* g
  76. char *dmabufdest2 = NULL;
      ^; {* G/ w' H2 Y) ^  v
  77. 5 Q# h2 }+ U' b" t& p" ?# W
  78. static int acnt = 512;4 U" K! E/ h# G& f6 {
  79. static int bcnt = 8;
    ! N+ ~5 H4 l( F$ N
  80. static int ccnt = 8;! ~) Z" Q: ]- w/ U* h; N" ^# ]
  81. / q6 q3 S: I4 l) U3 f
  82. module_param(acnt, int, S_IRUGO);
    8 G6 d! v3 Y, Q$ e& H
  83. module_param(bcnt, int, S_IRUGO);
    + p. C# V7 N+ ]  U5 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( H: A7 f: s0 P( H# _+ t
6 J5 M) I; T9 r9 c6 L/ r( k  B' Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Y4 i* n" v$ j% B2 N# G% Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& z9 J: f3 M7 N0 R5 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! g  [# {6 u  X! e# e

. n# F$ m3 \7 ?( |, {5 F7 U$ N9 _( h& O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 01:36 , Processed in 0.039716 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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