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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' U/ ?( W4 j) P: t. ?. U7 v; }
  1. [code]EDMA sample test application$ e* k" R, h9 j* |, ]4 v. t
  2. /*2 a  e, S, s$ s4 g) C4 t3 z
  3. * edma_test.c
    - L2 b4 w$ v. L5 n6 U  x; _9 \2 s
  4. *
    , ], i3 h) H. b/ x; g' ]5 g  i
  5. * brief  EDMA3 Test Application4 p) d# q5 B$ r- |$ _; n- f4 J
  6. *
    3 \9 I$ d0 S7 q0 E- F5 q
  7. *   This file contains EDMA3 Test code.& {, i5 Q( G# E+ W& A4 ?
  8. *- Z* K% l# f! C' q; m% [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! L3 ^" ~. C* j* ]% D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 V1 T* j- ^9 J6 H* @
  11. *         TO CHANGE., @) u$ r- q5 r. o
  12. *
    ( B8 e, L: `/ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " ~" J! C( F5 b/ a+ }0 u) U
  14. *8 p9 K. h9 C4 n$ E4 l$ [  k2 l% `
  15. * This program is free software; you can redistribute it and/or# Q" x* p4 u  s! m) I( X
  16. * modify it under the terms of the GNU General Public License as$ y: v  j/ s# m; s
  17. * published by the Free Software Foundation version 2.
    . u( d6 Q( t, z+ G
  18. *2 Z( Y' Y/ K+ l! n7 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ E, n; |% I" R5 y0 x
  20. * kind, whether express or implied; without even the implied warranty
    ) n6 V3 V1 [) v6 l/ }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) S4 |  V. f  v# m4 p+ F+ q
  22. * GNU General Public License for more details.2 X! z' ?4 b  {+ R. M# Z0 I. O
  23. */: U  [( ]. R: x, E! Q: A

  24. 6 F% m4 p1 B9 n( d$ B2 e
  25. #include <linux/module.h>
    5 X7 L9 S2 I6 y2 E2 C3 U/ |1 D
  26. #include <linux/init.h>$ V2 U+ D% \0 c8 D5 o
  27. #include <linux/errno.h>
    ! ~4 ]) V; k; {1 j
  28. #include <linux/types.h>& U* d& R- @; [$ N
  29. #include <linux/interrupt.h>6 ~5 y1 f& W6 ~: S: n
  30. #include <asm/io.h>$ e2 P+ `- p1 X9 e0 O
  31. #include <linux/moduleparam.h>
    + |5 G* t! {$ T) }$ ^6 t- F
  32. #include <linux/sysctl.h>9 E# o' F( Q" w- t# _
  33. #include <linux/mm.h>
    . N. J5 _: p; B+ I
  34. #include <linux/dma-mapping.h>
    # v* U# m7 \; v" `+ t
  35. + G. t4 z% E& u( R. F
  36. #include <mach/memory.h>/ Y! k' X' z7 {, y1 c, v) q. c7 m
  37. #include <mach/hardware.h>; U% j# @  R, Z* @* r
  38. #include <mach/irqs.h>
    & X+ d* L2 g: O6 c% E' R; }: [
  39. #include <asm/hardware/edma.h>
    6 m& F5 d) \( D9 a; S& q

  40. ! N/ D7 J6 u  X9 g! t
  41. #undef EDMA3_DEBUG; N$ I7 z3 `, d, M) R0 Q" q
  42. /*#define EDMA3_DEBUG*/
    ; R4 s( U. ?3 s2 }7 R

  43. - O  j4 }! j  D2 E
  44. #ifdef EDMA3_DEBUG! @6 W. C. M$ \! ~, Q/ V$ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 h* S7 J/ m/ [0 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! N8 d! O9 O( s) d7 [; Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]1 R0 k. u3 E1 P
  48. #else
      @0 L& W; F7 m: L( b
  49. #define DMA_PRINTK( x... )! P5 L! @) G. ?" @( L) w0 B1 W
  50. #define DMA_FN_IN/ N' y) F  y; j0 a. h3 F1 d
  51. #define DMA_FN_OUT
    5 u1 X1 X4 z. a5 M5 k; C8 k2 T
  52. #endif
    & O6 p6 k+ n, [8 _
  53. . b) F. F* r" }* K0 w+ d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' b( Z3 L& U% U$ ]4 _% H8 r* W
  55. #define STATIC_SHIFT                3/ x! ^5 |9 T6 ?, T% ]# \
  56. #define TCINTEN_SHIFT               202 R- B! M% X, [0 j3 N& z7 |) |
  57. #define ITCINTEN_SHIFT              21
    - g, e0 |! N0 l0 B  A# f- d
  58. #define TCCHEN_SHIFT                22
    4 j3 s. D$ W) V$ y
  59. #define ITCCHEN_SHIFT               23: ~2 ]# s0 s7 Q5 {9 f

  60. 8 p0 F% D+ W  d& I3 b( q
  61. static volatile int irqraised1 = 0;
    ! `& J% c4 `: |6 N
  62. static volatile int irqraised2 = 0;$ J# [/ E, C. p4 k0 V( I
  63. ' g2 I: `3 @, |; j" \% }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) [( `$ g* o" m0 m; a( I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * P. G. [' l5 r/ ?2 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ t+ @0 Z' y9 Z- d! f. K9 G

  67. % h+ G' S  }6 M
  68. dma_addr_t dmaphyssrc1 = 0;
    - n2 S( S3 Y3 _, N
  69. dma_addr_t dmaphyssrc2 = 0;2 Q: \* H0 R1 V$ N
  70. dma_addr_t dmaphysdest1 = 0;& u5 x( d  m: _# q: @
  71. dma_addr_t dmaphysdest2 = 0;
    - o6 @. l! r- m5 U% H9 W6 f& B
  72. & `4 q" ^' i6 x* T( ^, I: {
  73. char *dmabufsrc1 = NULL;
    , U+ |( O5 y" X+ V: J+ G
  74. char *dmabufsrc2 = NULL;. S4 v- ?! G& J& S5 p. A
  75. char *dmabufdest1 = NULL;$ D$ \' j+ g! }9 X$ ^. N; ^
  76. char *dmabufdest2 = NULL;
    8 ^. H0 z; p4 _% B# O
  77. ; P& Y# A6 g4 b* e2 x
  78. static int acnt = 512;, u( I$ ]3 ]! t7 ^
  79. static int bcnt = 8;
    9 r) j5 @5 z+ C+ M4 r
  80. static int ccnt = 8;/ D+ S- s8 m( s  w9 V6 w

  81.   f8 x  Z4 \! q2 q% G
  82. module_param(acnt, int, S_IRUGO);
    5 v1 `* S9 ~6 l
  83. module_param(bcnt, int, S_IRUGO);# c5 _* U9 \' \. a3 e: J, F0 i. t7 j8 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* f8 U3 U$ h* ~6 P) W6 T. y! t1 q
$ J; V/ V, m" h2 I0 C8 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ H9 o2 p( j$ V4 K" S, farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 S; N  o% }0 L3 K5 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, K8 i- n* P; f! A4 `& H

1 G- N% y" J/ D+ B! O% T6 t. d4 F0 W9 y3 v- d' ^2 U: F, \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 00:12 , Processed in 0.039091 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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