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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) }+ _( l% b! x
  1. [code]EDMA sample test application
    . M$ s% H1 R& g8 q3 H3 E6 L
  2. /*
    ! F, S* R9 P( U# Q0 U9 j: E
  3. * edma_test.c4 F9 H4 ]. _* X: o
  4. *
    % c6 \2 n3 m2 b! K; u
  5. * brief  EDMA3 Test Application
    1 r1 V7 T! }% y4 ^* S. \
  6. *
    * x  J( z/ x( }! L+ E+ @3 b
  7. *   This file contains EDMA3 Test code.
    % l7 p3 Y$ o: P9 ~1 I, |$ r
  8. *8 ^4 |  L$ V% H. H5 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # Z& U' X, m7 D4 M! R  W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * p, e# K+ f: ]" x: T, k
  11. *         TO CHANGE.
    7 P& _; H/ G% F, t! s, g4 F0 V
  12. *
    3 U* o/ a5 Y! W0 Y% n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, E) Q4 e8 o7 E
  14. *
    9 Z+ O( K8 U* {6 {! U9 D
  15. * This program is free software; you can redistribute it and/or
    # t( p  m/ E9 }
  16. * modify it under the terms of the GNU General Public License as
      h7 k( `2 m1 f3 u" C
  17. * published by the Free Software Foundation version 2.+ ?" r+ T7 u- X8 E$ u3 Y7 O  }
  18. ** h* D& [  D  {8 D3 G% F2 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  X; B1 z  K9 h& V4 y
  20. * kind, whether express or implied; without even the implied warranty8 a- J$ ]6 C" G- P2 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, \: E( R4 j) u* g% [+ c
  22. * GNU General Public License for more details.% }! P8 u, l7 [4 g; M- ?1 g1 E
  23. */
    % w  S  P8 o4 U
  24.   X: Y  b' t! i. f
  25. #include <linux/module.h>
    ( N0 s- G2 |3 W
  26. #include <linux/init.h>$ X7 i6 C5 m7 s/ {( F* q
  27. #include <linux/errno.h>
    " g6 r3 Y. p" v. ~. o3 {
  28. #include <linux/types.h>
    : p4 N7 Z3 w5 l. `
  29. #include <linux/interrupt.h>- E5 b5 y8 f' S* r6 q7 F/ h2 Q
  30. #include <asm/io.h>1 U% C# x8 x5 z4 I
  31. #include <linux/moduleparam.h>
      @( Z6 G! M% E$ Y4 [9 x
  32. #include <linux/sysctl.h>
    - @0 a; T4 I2 `$ K
  33. #include <linux/mm.h>
    7 \3 ^( N/ }& Q% x, y6 }, r1 ^
  34. #include <linux/dma-mapping.h>6 M1 e6 l; l1 c6 {+ h/ E
  35. 9 l  E# V' K1 @6 G. N# ^+ R8 t" a+ N
  36. #include <mach/memory.h>
    ; {, q  h7 o6 l' ?
  37. #include <mach/hardware.h>
    % M+ f) s8 {9 a5 ]" x- G3 h
  38. #include <mach/irqs.h>4 }8 \& R: o& G6 u3 I. ?' Y  ^- }
  39. #include <asm/hardware/edma.h>
      V4 e# q  y( c" @3 G

  40. ' k4 H" q: X8 w( V: A
  41. #undef EDMA3_DEBUG
    ; w2 @5 K7 m, x
  42. /*#define EDMA3_DEBUG*/) \& u% V* i7 c4 u
  43. ; b1 f  X' a2 R7 U, ]6 ~
  44. #ifdef EDMA3_DEBUG
    ! u  j# a/ V* D2 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' c7 @, r, ?+ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : t& Z9 [: I- H! g' l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- @1 H6 ]1 Y+ i8 x  D; ^! V
  48. #else9 ?4 t" f/ m+ [" {
  49. #define DMA_PRINTK( x... )9 V+ e: T3 A& |; U( v; t
  50. #define DMA_FN_IN7 m3 g& h0 u* E8 _
  51. #define DMA_FN_OUT2 {( r5 S% n9 E
  52. #endif  Y8 z2 M4 J3 M9 z

  53.   d$ M% o3 G% d  R7 u7 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 i( ^' W3 n! T2 B* D1 p2 H
  55. #define STATIC_SHIFT                39 u, k: K/ I& _* S" U( g
  56. #define TCINTEN_SHIFT               20
      p. D8 G8 a9 `6 d; W) y$ s" p
  57. #define ITCINTEN_SHIFT              21: Q' a. c6 ]& `4 ^  @
  58. #define TCCHEN_SHIFT                22$ w4 T0 w: W% ~5 F2 `
  59. #define ITCCHEN_SHIFT               233 a, m: g9 f5 I6 n

  60. ! T' Y- A3 n/ [; H0 H; n
  61. static volatile int irqraised1 = 0;: q% M# s. p0 e0 l/ D1 \+ Y9 V
  62. static volatile int irqraised2 = 0;( T% j7 r- p, m+ N

  63. - Z  {$ \5 h: q0 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  |( J2 h) [- o6 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 |6 A3 O# p# R3 i' ~% `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F4 I2 B) I( Q0 _
  67. 2 F: A' g2 W2 j/ ]
  68. dma_addr_t dmaphyssrc1 = 0;
    + l. s  U& z2 p( I, h) u
  69. dma_addr_t dmaphyssrc2 = 0;$ e, M5 w) |. Z0 Z6 R
  70. dma_addr_t dmaphysdest1 = 0;
    - r# J  N0 v3 T# y3 p6 Q! E
  71. dma_addr_t dmaphysdest2 = 0;, f7 y1 R' F; Y0 v; Q. o

  72. 3 F# o5 D- s1 S9 d. f! M: S
  73. char *dmabufsrc1 = NULL;
    ) Z5 I; G$ @5 k! h. j& z+ T
  74. char *dmabufsrc2 = NULL;
    : _/ ^, f. H5 y& N8 G0 V) _" F1 R" X
  75. char *dmabufdest1 = NULL;% g% f; W9 X9 d8 `, S1 T
  76. char *dmabufdest2 = NULL;: w5 j" [* ?; l  E- S# P

  77. 9 Z  E" M7 [! y0 x* N( N. k
  78. static int acnt = 512;; G# W% P2 }+ s4 l3 }( P; i
  79. static int bcnt = 8;* [8 Z+ E+ b: w9 u
  80. static int ccnt = 8;7 u! {! u2 R" k* ], D$ D( F7 N

  81. * O; E, E0 ?" n
  82. module_param(acnt, int, S_IRUGO);
    8 o  p! X" m9 r7 z' q5 [$ O  p+ D
  83. module_param(bcnt, int, S_IRUGO);3 a2 O- \' v4 o( y: [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  v" f/ a. N( l3 h7 i5 x2 ?/ A, t. ~6 h" M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- m0 @: d) ?! |  carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( P2 t, z- c. r$ J* }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) |7 L; r2 g. W: b7 j
5 x4 b: N( r" z: N! P( o
' ]& N+ A) X- x/ r! ]2 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-18 10:29 , Processed in 0.040042 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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