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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 |+ Q4 {5 v- x: y4 X$ _
  1. [code]EDMA sample test application/ G% h$ K) c% D! O4 Z8 W
  2. /*9 J3 M1 s8 }9 ?& \8 {. z
  3. * edma_test.c
    0 T7 \5 b/ E. N' h9 d
  4. ** s  {  ^/ j2 ^* S4 n4 L3 c
  5. * brief  EDMA3 Test Application8 r% s1 a& g3 b6 l6 L' p: D
  6. *$ ~! B: T% O) m" v: K! m  T1 `
  7. *   This file contains EDMA3 Test code.2 ~8 Y+ a0 o/ H$ ]
  8. *
    % M  R' P9 U  K0 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 A2 [6 `0 s1 R/ Y6 x/ Z" p) g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , c- A9 D$ ~  E. l4 t: o
  11. *         TO CHANGE.
    4 C* R4 R% g, L2 a4 }: \9 _" ~
  12. *+ p' Q" O' r% Y. E4 N; j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P" |* f$ W1 @9 t( _: M1 b4 R
  14. *
    ! l' F, g: v! H  ]. D: k
  15. * This program is free software; you can redistribute it and/or
    : p0 G% r$ x4 c1 A/ s0 @# A( ?
  16. * modify it under the terms of the GNU General Public License as
    1 A4 c9 A+ ?& `% Y$ c
  17. * published by the Free Software Foundation version 2.' O8 N/ W; C: E) c! O0 ?+ u
  18. *
    7 k5 ^0 a5 I$ U3 {# e6 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # L' K; x7 f: Y! s* T5 B2 N! N3 B0 H$ r
  20. * kind, whether express or implied; without even the implied warranty
    " {& M) W/ u( q" X7 d& A1 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 S& u7 A, w8 b
  22. * GNU General Public License for more details.$ n7 `) k& S7 z2 X
  23. */
    + I& \' `/ q$ x5 E1 a: V" P# @
  24. 2 l- B2 X& M# x- V
  25. #include <linux/module.h>) U, @( z/ h6 T) y& Q* b0 c- t' _
  26. #include <linux/init.h>
    3 Z5 Y$ b( ?) f- O, l, F
  27. #include <linux/errno.h>7 Z! F" s: F+ E1 M; ^+ l  m
  28. #include <linux/types.h>
    ) f! l+ z0 t) Q  V: C" f
  29. #include <linux/interrupt.h>, |1 ^4 _3 l; o. s; E, o
  30. #include <asm/io.h>3 ~$ b& j& m" r
  31. #include <linux/moduleparam.h>3 K/ v: S. ^* O+ _- F3 B% v
  32. #include <linux/sysctl.h>6 ]: c5 I& ?+ d& ?1 v2 o, ~0 O' h
  33. #include <linux/mm.h>+ P6 Y& X9 g% I5 p; R! n
  34. #include <linux/dma-mapping.h>$ y' Q# x2 R5 Q+ L1 @0 ~

  35. 0 g* N: E0 {# M8 r, {
  36. #include <mach/memory.h>$ H* s! ~' F* v0 L. b' j
  37. #include <mach/hardware.h>2 S4 D1 ?4 l$ o3 }: |( _5 P% J- \
  38. #include <mach/irqs.h>
    4 z2 n7 @" R4 [2 J  k
  39. #include <asm/hardware/edma.h>
    / S8 V( S6 j4 n+ `* ^. P( J; U

  40. ; F9 @% c4 M# H) g
  41. #undef EDMA3_DEBUG
    ' |0 F' T# T# `6 K0 U- f$ m3 ?
  42. /*#define EDMA3_DEBUG*/
    % }  B9 h* [& i

  43. 2 ~4 Y* L6 L. Y" G- T
  44. #ifdef EDMA3_DEBUG
    # a, f( K; x6 k( V! t; I2 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' U6 ^: [. g: t# N' m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! C$ c) k$ ?0 g4 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) \, T$ @, }# _1 i: F- L, x
  48. #else
    $ s& y4 s8 `- W
  49. #define DMA_PRINTK( x... )6 x  i( w7 T/ l7 Z+ g
  50. #define DMA_FN_IN
      H7 [) a& T: n0 F
  51. #define DMA_FN_OUT
    ( H3 m$ C) {$ @6 d$ f' ^
  52. #endif
    & V9 q3 D! g0 A' o% r+ a  V

  53. ; q0 \+ L, ?, D# ^; L9 i, r$ X3 Y  q8 c* ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . G  h2 P4 h! y: Q: O
  55. #define STATIC_SHIFT                3' o9 D$ L5 P8 d- _  N4 f
  56. #define TCINTEN_SHIFT               206 i9 a- l  T) t5 s
  57. #define ITCINTEN_SHIFT              21: H- Z; @4 d9 j; B! P) P" A9 c
  58. #define TCCHEN_SHIFT                22
    9 j1 i& [; {5 _# c
  59. #define ITCCHEN_SHIFT               231 a- \, R# k4 R

  60. . D& ?% Y. Y$ z* h2 Y2 K' F  C
  61. static volatile int irqraised1 = 0;
    7 h' B, A8 I, l; U4 V- y; I
  62. static volatile int irqraised2 = 0;
    + M5 D+ ^: E% |

  63. ' d/ f" y- _2 N! g- e$ M0 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u0 v0 T6 v1 k9 S5 `* o. {* j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^  I' h4 u* n. b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! {/ i- Y. X8 b- u2 @1 N
  67. # P- w9 _# S9 t( X
  68. dma_addr_t dmaphyssrc1 = 0;
    ) `. l. P% h; N
  69. dma_addr_t dmaphyssrc2 = 0;
    3 w2 B+ |, r) O1 C
  70. dma_addr_t dmaphysdest1 = 0;
    + B6 e! |4 ]. @/ g
  71. dma_addr_t dmaphysdest2 = 0;5 b: n( x* F% a- c& N$ P

  72. . q' i$ K5 Q" G4 F) y' `* K
  73. char *dmabufsrc1 = NULL;
    . H- u0 ^/ y/ b3 e( J- z+ |7 a# A
  74. char *dmabufsrc2 = NULL;+ l$ K7 L# r0 W+ e' u  g0 F- T
  75. char *dmabufdest1 = NULL;8 e3 h6 @* [, V: d, F
  76. char *dmabufdest2 = NULL;/ u9 e+ o! F8 [$ _2 L9 _( K- b
  77. & @  _8 X& w8 d9 f0 f
  78. static int acnt = 512;5 N! _& w) u. Y9 V& j3 P
  79. static int bcnt = 8;) Q4 T: V$ Z, g
  80. static int ccnt = 8;
    1 o! o' w8 v; v5 k

  81. , Y- ?; e4 ~6 _( o- u
  82. module_param(acnt, int, S_IRUGO);7 S3 E: ~5 K) P- o
  83. module_param(bcnt, int, S_IRUGO);
    $ b2 }& q. X# B) v# E8 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 K' @/ ?* z/ R  h5 M
+ I' d) D; D7 y+ G. Q: v: ?+ P6 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% R% s+ r( V( f- B5 B. l5 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  F4 e" N7 A% x& W: k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- C8 }/ }9 M! H, C  r! S( ], w$ `7 @. V+ x* g; w5 Q
5 N- @* u% J% W' e( d: H0 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 16:26 , Processed in 0.039334 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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