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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Y+ {" J" w$ P- J- x
  1. [code]EDMA sample test application
    * y1 r1 y8 {' \+ X
  2. /*
    $ I, A: G( X3 P& b3 q; d
  3. * edma_test.c7 v& o) u0 z; e1 v9 C
  4. *
    8 P- K8 b* k* e
  5. * brief  EDMA3 Test Application9 p5 y- h& I2 L# [  f" p* F% |% I+ z
  6. *
    / z# T6 `- l6 y2 s4 }: P/ K
  7. *   This file contains EDMA3 Test code.
    3 ]& ]% D- x( n( |2 e. o3 m6 s6 t
  8. *
    2 y, {0 Y0 x. @  r, {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : J) G" t+ R9 [! Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 R3 K1 a2 [2 g+ Y5 U  g
  11. *         TO CHANGE.
    & n0 B& Z/ O$ ]! A8 ?1 a
  12. *
    ( T$ o6 P% w5 R  k6 P( z! ^9 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 I6 F: N4 E3 N& L
  14. *" g# O- A: t% L+ G/ N4 b
  15. * This program is free software; you can redistribute it and/or" [1 D5 n# d+ M$ y# `
  16. * modify it under the terms of the GNU General Public License as" E% c0 c. g4 M  K% s3 J/ F
  17. * published by the Free Software Foundation version 2.: [$ j- C" a6 ]
  18. *
    , |! Z$ f) R! ^" {/ n, c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ?& ?4 ?/ O0 {" i0 w5 }
  20. * kind, whether express or implied; without even the implied warranty% v: s' G( \; o! _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; V- v3 K) e/ }- s" f1 W# @9 C" y
  22. * GNU General Public License for more details.4 D5 M$ S& C% z. f  B! H1 F
  23. */
    3 F+ b) ~& u$ c5 W
  24. / A( M- Z% _. y; c+ ^
  25. #include <linux/module.h>
    9 r' _, Y$ @) V3 n& P* w/ J
  26. #include <linux/init.h>
    1 I& \, b+ \7 m9 m. G! t; u2 ?
  27. #include <linux/errno.h>
    9 O& |" @1 k0 k2 V' u& Q
  28. #include <linux/types.h>, r) D+ q0 b( ]5 r
  29. #include <linux/interrupt.h>+ Z: z5 n3 d: j7 Q( H+ T  |
  30. #include <asm/io.h>, u7 b# z5 Q& m
  31. #include <linux/moduleparam.h>
    9 p6 u7 W% e. R; \3 p) k( Y
  32. #include <linux/sysctl.h>3 U4 `4 w+ R- y4 x
  33. #include <linux/mm.h>& y- t1 F. i7 K: a# k  e0 R  ~2 i
  34. #include <linux/dma-mapping.h>
    ' k/ J  o- d8 ~" g. R3 D

  35. : J% p. N! \9 l+ e6 v% n
  36. #include <mach/memory.h>$ f& }$ ^2 J# `! O
  37. #include <mach/hardware.h>! O  T4 i0 y7 k& W
  38. #include <mach/irqs.h>3 x' P5 q0 Y& \: q4 W1 z6 L, K
  39. #include <asm/hardware/edma.h>, w% Z- {  H0 r* z7 `

  40. & m7 u3 p. z' k/ l! `
  41. #undef EDMA3_DEBUG
    0 p( {$ K/ T# `1 B8 ^
  42. /*#define EDMA3_DEBUG*/# O" c9 O6 P: x$ Y2 a, b) R

  43. * X) u4 R, o1 I  q
  44. #ifdef EDMA3_DEBUG
    5 ]4 T% A/ A: m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 [/ p6 N2 Y+ G( i- [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ^. T" u( [: Y* G# Y4 C* }+ y1 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # g4 g  R9 w- |; w& Y
  48. #else
    * [7 E" b% M7 ?. m9 e
  49. #define DMA_PRINTK( x... )
    9 x( `9 B+ }6 B% N' Y
  50. #define DMA_FN_IN8 m! u  p' R+ b9 p! }- V3 q- U
  51. #define DMA_FN_OUT$ d0 T( w+ D6 p% [4 r3 {
  52. #endif
    9 `4 f1 P6 d+ Y- P3 G% f

  53. 7 z* G2 O0 T0 w9 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( D  k6 z6 z/ v5 D. G3 R# g
  55. #define STATIC_SHIFT                3# l! [8 V3 w5 y% h9 z2 X
  56. #define TCINTEN_SHIFT               20( d3 l$ j. |' F( D" Q- H: n3 U
  57. #define ITCINTEN_SHIFT              21
    7 g8 v/ I1 G' G, S# O8 O) c0 @
  58. #define TCCHEN_SHIFT                22  v; v  Q/ U: t1 @) j7 p
  59. #define ITCCHEN_SHIFT               235 I( `# S/ }' B7 s

  60. / c! F+ [' W- H. i  v
  61. static volatile int irqraised1 = 0;* |& e, \; A' H# X+ k: h5 k# O
  62. static volatile int irqraised2 = 0;. F; t( {$ b# m2 \: n8 m
  63.   c! O& m) T" u3 f  @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 }0 |; l( ?) n1 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % }, Q0 X" z& H) S' V, w2 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. }; {# K! G" ~' N" d  D
  67. $ Q; N3 E) n/ o- p, Y$ T+ B: B
  68. dma_addr_t dmaphyssrc1 = 0;# p" _& R& m( n" I, i
  69. dma_addr_t dmaphyssrc2 = 0;
    ' P1 S- _5 m4 K* _
  70. dma_addr_t dmaphysdest1 = 0;
    & P( F% p# i4 P1 }: u0 ~$ _
  71. dma_addr_t dmaphysdest2 = 0;+ m; ~- G/ Z0 }" x

  72. ) D( e# \# W4 s: T- P
  73. char *dmabufsrc1 = NULL;
    1 d- X! [' s/ v; y
  74. char *dmabufsrc2 = NULL;! G6 ?+ `1 A$ }2 R) e& U3 I8 M
  75. char *dmabufdest1 = NULL;$ S0 S5 S4 Y) o" K% @  ^! Q; m
  76. char *dmabufdest2 = NULL;2 i& u4 W2 |+ w/ s$ F' T+ d

  77. 0 M# V4 y) x' F- q- r
  78. static int acnt = 512;9 R% C8 H  ]& H" r+ T
  79. static int bcnt = 8;
    1 b' s0 H5 Q9 F
  80. static int ccnt = 8;: f, i4 E# k( c& }$ z) j
  81. 7 E6 ]: J- u- @% P1 @: ]
  82. module_param(acnt, int, S_IRUGO);) i  _# }* z3 \  g
  83. module_param(bcnt, int, S_IRUGO);
    6 B6 B  k/ M: ?# D- ^: {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% `, N  {! H; F( |" u1 C+ @$ c/ A/ J+ r- H1 A% X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J, A1 c' S1 e& ?- q8 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 F% E& m3 h$ K& C6 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( }$ q7 T$ ^2 Y$ S

. T: U7 V  C& l6 _3 U
. O# M: L0 S( l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 17:19 , Processed in 0.039748 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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