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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. {( ]! Z2 \" Q1 H+ z! `6 p
  1. [code]EDMA sample test application& a# @* X/ U  N) B0 N5 }
  2. /*
    ; N. _' Y& J9 E
  3. * edma_test.c4 _% A% z: m# X9 z- i+ ]+ E) [# }
  4. *2 K$ L1 T; f5 D% X$ ~* o
  5. * brief  EDMA3 Test Application5 Q7 W, f4 H6 }: ?/ @
  6. *
    / N5 Y% z7 G5 Z2 c
  7. *   This file contains EDMA3 Test code.2 z: \8 v$ I( ^: v$ e
  8. *# U0 g2 \3 f6 D7 t1 I6 a' B) W" E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ~* N1 G6 d- {; I3 D# ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! \( E$ \+ ]6 t! i1 w
  11. *         TO CHANGE.. u8 l2 ~/ k. Q6 d: L4 G
  12. ** @- @7 a( ]$ f0 \2 ?/ U# A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 D3 `) ?; O- m, `
  14. *2 {) E, Z% M& L& j
  15. * This program is free software; you can redistribute it and/or
    ( k/ z  Q# V% @  M- e
  16. * modify it under the terms of the GNU General Public License as1 c3 Q" g1 W7 C8 Q; e
  17. * published by the Free Software Foundation version 2., ?5 Y  f7 a% c) d) Y, r
  18. *- Z( S7 e5 Q1 s, Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 A" a6 |; `7 z, L; @- o6 ^
  20. * kind, whether express or implied; without even the implied warranty. w" z" ~5 K+ ~, j, g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 R9 |3 b- N9 W/ r2 g$ [
  22. * GNU General Public License for more details.' H7 m0 a( n5 b" P8 f; Z# ?
  23. */
    " h$ \0 r- w# ?2 @. u" }) g/ p

  24. , o! N. s. S: J
  25. #include <linux/module.h>2 z9 X: i1 Q: n# A! f+ L" R
  26. #include <linux/init.h>
    % S+ O+ H" T. ~; o. I9 Z+ }  v
  27. #include <linux/errno.h>
    4 I3 W; G. G1 M$ T4 q9 ~: _3 W
  28. #include <linux/types.h>
    + r, L+ ^- X& H6 g2 `: E0 J  I2 I
  29. #include <linux/interrupt.h>" ]" v2 C* n) J2 b2 ^% q* p
  30. #include <asm/io.h>
    ' q6 \5 Z$ F2 w: S7 ~. F+ N4 P
  31. #include <linux/moduleparam.h>
    . m- I3 R& X! r6 x& ]  J
  32. #include <linux/sysctl.h>
    & M* x: C1 P6 k6 v
  33. #include <linux/mm.h>
    6 T7 I" p% m( Q/ H7 a: Q1 U
  34. #include <linux/dma-mapping.h>0 E9 N+ X3 A7 s/ J& X

  35. / o0 `- l9 F, [7 D
  36. #include <mach/memory.h>9 `) r; G' A$ G; K0 r0 T
  37. #include <mach/hardware.h>
    . D$ j, f1 J. G9 |5 w% [8 ~: U
  38. #include <mach/irqs.h>, O. A7 s; G8 a! ^! a$ \
  39. #include <asm/hardware/edma.h>  c& \5 |3 n- ?
  40. # W5 K3 z$ f7 {. L; ]4 X7 d8 `6 t
  41. #undef EDMA3_DEBUG
    7 k) t: a: S7 ]+ w9 _/ s
  42. /*#define EDMA3_DEBUG*/
    / P7 K  j1 ]  ~
  43. * v. n, l- N5 F! U( Y
  44. #ifdef EDMA3_DEBUG6 ?. K. r4 N8 e# L6 ?5 C4 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 s/ n( P/ i* O* H1 e0 ?1 }3 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . x- E& t. t7 A$ [* e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 m% k) q2 [" Z/ Y
  48. #else4 F; ]) [; C  ]- K$ k! T
  49. #define DMA_PRINTK( x... )0 ~4 i0 u1 _% }* b
  50. #define DMA_FN_IN
    9 S( b9 c+ e, U7 b" Y8 ]2 q( A
  51. #define DMA_FN_OUT, d- |, z& A/ e2 A& D
  52. #endif- X) B( Y2 r2 n0 p8 q  z

  53. + i' J  O! N: m) _  G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# r+ H9 U3 p) f( z6 `  W: f
  55. #define STATIC_SHIFT                3! U! A& _8 _" x" ^! q
  56. #define TCINTEN_SHIFT               20+ J" A/ s/ K# ]: W$ t- j
  57. #define ITCINTEN_SHIFT              210 v6 F. B- g8 e# k+ S" b3 Q
  58. #define TCCHEN_SHIFT                22
    , C. {) s& O2 j, }/ {
  59. #define ITCCHEN_SHIFT               23
    ! L# _, y, X% t" }: J. q

  60. 8 q# [! Z% V" B; K: J8 ~% _' [8 e
  61. static volatile int irqraised1 = 0;. e2 q5 }# n3 ^# D0 c3 E5 J
  62. static volatile int irqraised2 = 0;
    / n3 k2 {0 k' \) W/ `" t
  63. 3 @9 E9 G: Q/ D- U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + u- R  w9 P5 y3 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O6 F$ I. [- |6 a$ [% C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + J# w( Y) ^& H& S
  67. 1 w" j; a2 ]2 p2 q& r
  68. dma_addr_t dmaphyssrc1 = 0;6 M" R& ]- J, h* ?
  69. dma_addr_t dmaphyssrc2 = 0;
    0 K0 g  A. m' K) Y" U4 X6 r9 F
  70. dma_addr_t dmaphysdest1 = 0;1 u; p$ f) o- u9 f) ~  h
  71. dma_addr_t dmaphysdest2 = 0;
    ; C) c; S5 y5 c3 {- s
  72. 2 h$ m* e* J& K* X% J( m3 a
  73. char *dmabufsrc1 = NULL;
    - X2 ^2 J5 ^. q7 G: n
  74. char *dmabufsrc2 = NULL;
    3 c* B; q) K5 a( [# j/ i
  75. char *dmabufdest1 = NULL;
      z& V1 H" }1 k, O, v9 ?
  76. char *dmabufdest2 = NULL;
    * _; j. F& N. |5 ]9 F

  77. ! @1 N$ |& V  j4 c. ~, G
  78. static int acnt = 512;
    * }/ b- e0 X" Y
  79. static int bcnt = 8;# z. D. H& G1 T+ K# o; f
  80. static int ccnt = 8;
    ! X( {  l3 c# v+ ]5 t- F) @
  81. ( F4 n7 d, b  D7 J4 A0 w/ j
  82. module_param(acnt, int, S_IRUGO);1 k0 y! I7 A& j6 a. G# R' u
  83. module_param(bcnt, int, S_IRUGO);
    ; X% X8 A: m8 }% @  j: g9 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Q- r" F" B) x2 E$ J9 l
7 N! D. p8 W8 p: d2 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% u3 e  X- T6 \/ s7 O6 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 B7 N, m* v% `; b! Z8 C" E: e8 {4 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# v* |7 S9 _( U( |# Q3 o/ ?, H1 d* Z0 g6 @+ C: x, `1 Q

9 P9 p3 X1 Z  w8 c5 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 16:16 , Processed in 0.038581 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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