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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ?4 P7 W9 Z, j6 M. N  {! |( Y& z- W; n
  1. [code]EDMA sample test application. R+ v0 K: ]! c9 f7 a
  2. /*, |0 ?6 V- w- a) }/ ^  w
  3. * edma_test.c7 e* s% p% t6 v, y' k6 L
  4. *' R: j0 B; q1 Z6 E! `3 E
  5. * brief  EDMA3 Test Application
    4 U: n' l( {& y; u5 e! d- B+ K. [" |
  6. *
      m! q/ u& l) V% l' e8 l; X" c
  7. *   This file contains EDMA3 Test code.
    * Z& V/ i+ u) z' `& ^
  8. *) U5 p/ Z0 C* M/ j# u0 }& q0 Q7 q. f8 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 Z* Q  N2 X8 j$ T. U( h. ?3 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * f& Q2 S$ |9 m4 ^0 N
  11. *         TO CHANGE.
    4 ?1 u; c/ E3 R6 s/ Y5 w
  12. *
    * c- o9 H4 y, E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 z3 Y1 H* u, g9 u5 m
  14. *& O/ v) I: H7 z# q
  15. * This program is free software; you can redistribute it and/or
    % A6 ?7 v) }# e0 @! {
  16. * modify it under the terms of the GNU General Public License as
    " q8 w( O9 i  O
  17. * published by the Free Software Foundation version 2.9 N0 S5 K6 I, K: c; m, D
  18. *
    ( k3 v, t( D0 W3 }& u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& n; Y* w5 E7 j* O1 t
  20. * kind, whether express or implied; without even the implied warranty
    # i+ f+ K3 |( r" h, |! |5 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 F3 r+ ^+ F# n, W5 b' Y/ ^! Y
  22. * GNU General Public License for more details.
    $ t$ e9 Q0 Z! q
  23. */% }# ^  f, \5 w: I: y6 m
  24. 2 f5 W8 d$ E* h+ M0 x* P5 ~
  25. #include <linux/module.h>- P# S, ~' k# C
  26. #include <linux/init.h>
    9 l$ @  d/ s8 _5 ?2 ~8 q# Y
  27. #include <linux/errno.h># h7 M. |2 c1 Z2 ~! m+ T
  28. #include <linux/types.h>  r( K/ A+ g6 K$ _* N
  29. #include <linux/interrupt.h>
    + J, S1 a* i! `/ o' n
  30. #include <asm/io.h>4 Q) q3 t6 ^9 s! o. p- R  j
  31. #include <linux/moduleparam.h>
    5 P5 c: ?5 A8 X/ s; A
  32. #include <linux/sysctl.h>
    % g# h6 P- w) i" n4 ]# d  o
  33. #include <linux/mm.h>: J" z( E2 B8 J
  34. #include <linux/dma-mapping.h>6 |" h& Y5 w! O4 `% E: K
  35. + S! n3 e0 p+ K$ n0 G, o7 e% Q. w
  36. #include <mach/memory.h>
    1 c: `2 J7 X8 x3 c$ ^& R; k3 X; l
  37. #include <mach/hardware.h>
    1 g3 r7 U/ X8 i- [' v9 Z* }
  38. #include <mach/irqs.h>5 a  D: f( h4 n+ T! R
  39. #include <asm/hardware/edma.h>
    . s, z0 A/ {8 t1 k

  40. % J1 {9 H: \2 V4 `
  41. #undef EDMA3_DEBUG$ u3 D: k1 [* O3 N
  42. /*#define EDMA3_DEBUG*/
    0 A6 \7 i0 Z+ f( x0 v0 p' f

  43. 9 Q8 J" P4 w/ H) L
  44. #ifdef EDMA3_DEBUG2 n. s5 e8 z' G: l5 `: o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ c4 u! S' U, L; v* }+ `( [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 o; t$ n- y2 V7 ~% @$ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 {4 {* |9 }! P7 |* N( a4 P- d! N5 B
  48. #else4 k& d4 L5 ]- f2 V$ V4 V
  49. #define DMA_PRINTK( x... )
    3 i8 q& |( x# R7 F4 L
  50. #define DMA_FN_IN
    , u/ N: k" W8 c
  51. #define DMA_FN_OUT8 `: O% `& y( z+ J
  52. #endif/ ^. y# p, u2 ]
  53. 6 d7 I6 m0 u" r. K+ X/ _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), E: e! B8 `4 i. v8 Z# S
  55. #define STATIC_SHIFT                3- o4 n* V1 A' u7 C2 i' v- N% A8 b0 H
  56. #define TCINTEN_SHIFT               20& _6 i1 }& i) C) W( P. L
  57. #define ITCINTEN_SHIFT              21
    ( {6 e! F6 T9 b3 R; g1 k
  58. #define TCCHEN_SHIFT                22: ^! ^6 |& O0 @% s; k7 q
  59. #define ITCCHEN_SHIFT               23" T8 [7 c: U6 @. s1 s2 U7 m
  60. % y$ G" ^* Y* j
  61. static volatile int irqraised1 = 0;
    & |% ]- O& R0 m6 _6 f% @
  62. static volatile int irqraised2 = 0;3 _2 Y& N/ k; H$ F8 X9 ?$ {7 g

  63. 6 i+ `( I5 M$ C/ ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * s3 W% {! B6 s2 D" n! O7 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }) j$ x' v8 G7 n* y& Q5 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 i* J6 w0 j$ a9 d- N" W
  67. $ [' d8 T3 ?9 Y2 F. X
  68. dma_addr_t dmaphyssrc1 = 0;$ P4 ]  P" T- }8 S% N4 E7 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    ! _4 [/ |! s5 T& X9 i
  70. dma_addr_t dmaphysdest1 = 0;7 e( Y" p4 v! Z: a' E
  71. dma_addr_t dmaphysdest2 = 0;
    / p& Z9 A, @; s1 h4 F+ ^/ J0 z  C

  72. 8 G) Y2 }4 L0 [% i, S) ~
  73. char *dmabufsrc1 = NULL;
    $ ~" {& n) T9 F
  74. char *dmabufsrc2 = NULL;
    ' r2 A, S" i$ J7 J; }% j2 G
  75. char *dmabufdest1 = NULL;, L0 S$ T0 a8 }1 d
  76. char *dmabufdest2 = NULL;
    4 `% X, V, U" F  t! n- A  Q

  77. ( \3 m6 |% j8 z% R9 v
  78. static int acnt = 512;: _9 U4 ^6 O+ a6 H0 u6 g% I8 z$ J
  79. static int bcnt = 8;0 `5 z. H# Z( q# c# ~4 H) D
  80. static int ccnt = 8;' a2 w  ]) m* U2 _: _7 C" e& b+ n

  81. 2 H  G0 E% Z  v/ I+ W6 ]0 s
  82. module_param(acnt, int, S_IRUGO);' ~+ R+ Z  @7 G; i: Z
  83. module_param(bcnt, int, S_IRUGO);0 P! _* u1 a! H1 M- ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 [9 X) P) M6 e4 b/ r2 r1 T
& e: Z, r5 J8 ^8 \. g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" W5 L' K0 ]% C% |# O( P9 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 b; Q/ Y9 _8 V( m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j$ U% B7 i' A" D
# J0 [8 h4 q# f0 @* F
, B( L+ _2 i6 _$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-27 07:27 , Processed in 0.052490 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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