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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( e0 l0 N- [! p8 Q; A( X
  1. [code]EDMA sample test application2 H' [+ v5 V& ]  k# [: C" C; A
  2. /*  B. z, q& @% x/ O
  3. * edma_test.c
    4 Q0 R4 |! y! Z2 Q1 O# w9 A: y
  4. *
    6 r" o  T& G; c+ o1 `
  5. * brief  EDMA3 Test Application
    1 G- r: D" k$ @1 p* o2 n
  6. *6 c, T+ M! I% ~
  7. *   This file contains EDMA3 Test code.1 }) e+ P3 h* Q
  8. *
    0 q* z' _( p+ l% A. k0 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 o2 u) h! l5 j+ N- v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; W+ E8 _. a$ Z
  11. *         TO CHANGE.
    $ O* w  s+ E" R  ]0 q& a
  12. *
    + i; {' H+ p; c% v& t* m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, u9 D) l% C* \- }8 v
  14. *
    2 `  Q& U% t1 h
  15. * This program is free software; you can redistribute it and/or2 w5 q& k! ]/ F7 z) X4 ~7 B, D
  16. * modify it under the terms of the GNU General Public License as$ t2 S. ]9 g" P( C3 h* o1 m% S
  17. * published by the Free Software Foundation version 2.. e8 K% q. d/ e1 @  o, J9 Z
  18. *
    & K# S: d+ @0 v; h$ D' J! ^0 X' Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. s  Y( k# y1 @. O
  20. * kind, whether express or implied; without even the implied warranty" i6 l8 y9 r  Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ d2 P1 ^$ _0 i) R4 g
  22. * GNU General Public License for more details.
    # v& }# E# T) b
  23. */1 y/ F$ o! D& T7 b/ s- w

  24. . e  A" [8 t0 ]. t% l5 S
  25. #include <linux/module.h>, f, K  Z5 W# R& v! X( R
  26. #include <linux/init.h>) T( S5 ^) V. c! [3 u
  27. #include <linux/errno.h>
    ( K: S3 i4 ^- w& I/ Y
  28. #include <linux/types.h>( P' [/ ~4 F: m; p
  29. #include <linux/interrupt.h>. [' h, b9 [: h6 {$ v9 `4 L
  30. #include <asm/io.h>
    2 T! ?& D$ @6 `/ c# s
  31. #include <linux/moduleparam.h>
    8 _# _& E( E% e  n; W: n
  32. #include <linux/sysctl.h>& K% z0 ?) G; C. ~# d
  33. #include <linux/mm.h>8 U9 c! b9 s5 a4 w: ]
  34. #include <linux/dma-mapping.h>  E4 L$ H& A9 J+ n+ M5 ^3 p

  35. * N6 ?' R2 t9 E7 p& p5 z, h
  36. #include <mach/memory.h>1 Q8 u" |) r) u- A! `6 {; s
  37. #include <mach/hardware.h>7 X8 ~) a( Z4 ?2 I( f
  38. #include <mach/irqs.h>
    : l( z. x- n/ s% p" \* M8 H8 z
  39. #include <asm/hardware/edma.h>
    + N$ R! r6 Z  ]& i8 D

  40. % `$ [4 T+ s8 f* }0 w  D
  41. #undef EDMA3_DEBUG+ j, m9 H* A) n" e
  42. /*#define EDMA3_DEBUG*/
    . p& Y) Y% x1 y
  43. & P0 U" Q0 [0 T! I  j( D! ]/ s
  44. #ifdef EDMA3_DEBUG$ a0 t. Y' z3 b7 `- ^  e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ X/ U( [2 O) A. c  J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! {  Q: v1 h& I& ?  r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 e2 n) _2 E  u% i9 E$ |0 b
  48. #else* n! r; E2 X9 ]; u6 m
  49. #define DMA_PRINTK( x... )" p0 \( o4 ?/ _: @0 n  s
  50. #define DMA_FN_IN
    , g& S; N; m! I1 ]; ]( o9 C
  51. #define DMA_FN_OUT
    * E9 x8 F, W% o2 p& k
  52. #endif
    5 B: M& E0 x  _6 t  e% X4 x
  53. 4 `( n' H- V2 H# I& d# s) F! q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& s4 P4 \- B) a
  55. #define STATIC_SHIFT                35 P6 r3 ]# Q( y0 M  G1 a
  56. #define TCINTEN_SHIFT               20
    3 @. N7 x" i& H' n
  57. #define ITCINTEN_SHIFT              21
    3 E) O% l2 u( V% V0 w! m4 q
  58. #define TCCHEN_SHIFT                22
    ; X- s+ i$ S- ^* K: A7 q
  59. #define ITCCHEN_SHIFT               23( P' d$ x3 _6 @! f, H9 w

  60. 2 `& V$ S' y; E0 u  w# x  @
  61. static volatile int irqraised1 = 0;
    1 m% l& G  n5 ?
  62. static volatile int irqraised2 = 0;" D2 B  r; P. F. R  y
  63. : H' I3 {8 @+ @& q; l0 n# B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 W; n/ H/ U" e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , x9 |; \* B7 O! O* n3 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      u& g" _1 b4 p
  67. * d, `& e0 X5 Z% Q
  68. dma_addr_t dmaphyssrc1 = 0;
    . a/ g* g* W' f5 h6 c8 i( K
  69. dma_addr_t dmaphyssrc2 = 0;
    : `* ^. }) Y" T, v3 O
  70. dma_addr_t dmaphysdest1 = 0;
    - C; n4 G& }0 H5 L0 W% i; l% i
  71. dma_addr_t dmaphysdest2 = 0;; Z7 V0 T, B+ }5 O1 ]4 a1 |& `
  72. ! k* _" p$ L9 o# Z
  73. char *dmabufsrc1 = NULL;
    ( S2 T( ?& e8 b7 n; G1 a4 j
  74. char *dmabufsrc2 = NULL;
    " k" t9 O# l$ J4 f& k( E
  75. char *dmabufdest1 = NULL;
    0 [" Q7 d% p4 K- H5 B
  76. char *dmabufdest2 = NULL;
    ' `% J- L  n" s; a2 J
  77. 6 u- v! Z  {* P( k0 U; @
  78. static int acnt = 512;- Z3 e- L: r& |( d$ ^
  79. static int bcnt = 8;+ d: T0 Z: j0 n2 W, j
  80. static int ccnt = 8;- B, W, C: Q2 s& u6 P# H
  81. 7 j% Z7 Q/ }7 Z; F
  82. module_param(acnt, int, S_IRUGO);
    4 j, W& }1 c$ V2 E& ~
  83. module_param(bcnt, int, S_IRUGO);
    ) H& z+ S9 x- c/ @* n! Y2 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 {9 B( E* [. D8 Z7 B
0 T- V- ^3 t& o1 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# y' l6 x! R6 @% Y( E* ~8 ?% Iarm-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. `$ g7 ]7 H8 G3 g$ P' c5 L4 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ }* u; y6 B4 g: \

" K1 J. X# t  Z6 k& K. {: M0 H. \5 _5 O; S# s( R( O% p& p- h& e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 22:36 , Processed in 0.044631 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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