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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 r$ Q5 Q  q7 ^3 e( @
  1. [code]EDMA sample test application( I. s. D5 Q; ]9 g! ~/ \$ D
  2. /*
    6 z" m! B1 `4 j. T6 u
  3. * edma_test.c: G2 m8 ~# ]8 Q. j8 u' {8 c* n5 G( A
  4. *1 b2 Z) x; T( l& A3 V  b
  5. * brief  EDMA3 Test Application" e4 Y% i- j  ]/ Y% Z
  6. *
    , c8 a0 E1 \1 T7 E& C& K; N1 M
  7. *   This file contains EDMA3 Test code.0 {+ E& T+ k& }, |2 @
  8. *- L! o8 N) H- i1 k/ I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ^0 K- h; e) Y9 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 S2 l1 V6 B5 t1 Z( q
  11. *         TO CHANGE.- F! k- D+ R; |  R0 |% a" C
  12. *
    3 U3 w; X" d7 h& b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : e. z9 ~, _$ U  Q7 E8 X
  14. *
    5 ^; b- X4 C6 P  n+ c0 z6 t
  15. * This program is free software; you can redistribute it and/or
    6 `/ D* c+ s0 W7 ~* l
  16. * modify it under the terms of the GNU General Public License as
    . l0 e& Y+ G+ O; x& ?: S
  17. * published by the Free Software Foundation version 2.
    $ i1 O4 j# N2 w' A2 k) w8 {! Z
  18. *& m9 Y2 L- X- R; e8 O) S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* J( S3 A. j  F  Q
  20. * kind, whether express or implied; without even the implied warranty7 S2 M' _( _( i5 k' \4 r# r# C! z8 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: k! D, J* B4 `6 Q2 R1 c
  22. * GNU General Public License for more details.3 s5 F* ]$ a% V# `5 v: u
  23. */8 I3 d( r; h6 k& E. G7 x, n& \

  24. % j" N) q$ k% _! K' ]1 K2 e) o- n
  25. #include <linux/module.h>
    : e& H8 J, Y) \, F
  26. #include <linux/init.h>
    ) M- |  p3 C4 z0 S/ c
  27. #include <linux/errno.h>" Z4 s1 x$ N3 ^! q( f
  28. #include <linux/types.h>/ s: o* \' |7 L9 @+ b5 t
  29. #include <linux/interrupt.h>7 V# ]" ?9 D3 n0 k, \9 s2 T9 C& L
  30. #include <asm/io.h>; ^( l7 `& S- e+ \3 j
  31. #include <linux/moduleparam.h>5 s0 D( r6 Q$ ]' S& L: d
  32. #include <linux/sysctl.h>6 w. r! c8 \+ j8 S/ Y. D- i
  33. #include <linux/mm.h>. X+ {& C/ Z1 B8 v
  34. #include <linux/dma-mapping.h>( w! X& F6 ^# B0 x* _
  35. - D$ E. L# O. s
  36. #include <mach/memory.h>8 h& y$ \, Y3 A* u# C3 P1 |
  37. #include <mach/hardware.h>6 N4 t% t4 j3 P1 S' U
  38. #include <mach/irqs.h>
    % k  y3 x$ I6 g
  39. #include <asm/hardware/edma.h>; A; [; i. G1 I* u' I% g  d8 \

  40. 4 w1 J: {9 _1 B6 t& u# a# }* \& j1 C( V
  41. #undef EDMA3_DEBUG# K( \' J* q% R
  42. /*#define EDMA3_DEBUG*/! U& R' G3 H* s2 U
  43. . Q' w( h( w$ b- \" a
  44. #ifdef EDMA3_DEBUG
    # v/ K+ I: N) p9 j4 g4 K' I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " ^1 E/ @& w/ }; a$ ~- L$ L% I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 d' ^( C: H/ U9 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 y( A; ^! g- c, n0 z5 G. @' U
  48. #else
    / t; |% |" U  a  l
  49. #define DMA_PRINTK( x... )0 A3 \- N  X5 T* K0 Y0 v
  50. #define DMA_FN_IN" Y8 z6 j; j$ P3 _9 ?
  51. #define DMA_FN_OUT* l" J9 b; J' C9 ?- X
  52. #endif
    4 {( i9 i* o' J* K

  53. ; b$ Z7 f- K3 i5 n9 L1 E' ]) g9 [" _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" k, O4 e+ P2 r9 _  U- N: g
  55. #define STATIC_SHIFT                3; d' E8 j% v) L( @- o
  56. #define TCINTEN_SHIFT               20  `" Q* n3 k2 T3 {" ~
  57. #define ITCINTEN_SHIFT              21
    , }& q+ w! m* s$ t% k; Q
  58. #define TCCHEN_SHIFT                22: o* P% d6 @, u/ f3 M
  59. #define ITCCHEN_SHIFT               23$ X6 k+ W/ v" C) F* @4 M4 z5 Y
  60. # G. P4 t8 b6 I0 l3 {+ C
  61. static volatile int irqraised1 = 0;
    ' @" j, |7 Q. `& G6 B9 M' Y4 e/ X
  62. static volatile int irqraised2 = 0;- t% ?- m9 C2 `( y; C! @

  63. : o9 F' \1 u: p8 Z# I+ l5 n" H3 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . s& v( ]/ v* n( h3 A* V4 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Y4 o6 K7 Y+ M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ q# a3 A7 y1 E4 Z; {) V- Y- C
  67. ( a2 `- s6 a3 l% G& X
  68. dma_addr_t dmaphyssrc1 = 0;
    & S2 c8 Q5 I  I: l
  69. dma_addr_t dmaphyssrc2 = 0;
    : W, [4 S& \" C4 _. }: D
  70. dma_addr_t dmaphysdest1 = 0;9 F1 E. c; I  D0 B9 n
  71. dma_addr_t dmaphysdest2 = 0;
    4 I8 W1 Y$ @7 j0 B3 D- R9 J

  72. ; [6 a0 R1 w" }) _0 G& A% \
  73. char *dmabufsrc1 = NULL;8 c! A2 K- P' O! s
  74. char *dmabufsrc2 = NULL;
    ) L2 r. P/ s: A
  75. char *dmabufdest1 = NULL;; _8 r& ?$ C$ S* e+ J
  76. char *dmabufdest2 = NULL;
    $ E+ v1 ?. T; K; Z4 L5 u
  77. 1 p7 S+ W& Y, Y
  78. static int acnt = 512;
    2 G$ `; W) l) `$ g1 r
  79. static int bcnt = 8;: L6 P3 t' D  q* E( ^; I. h" K
  80. static int ccnt = 8;
    : j& ?( X  V. M
  81. - y& F$ O" s. V- |8 c
  82. module_param(acnt, int, S_IRUGO);
    : |1 Z4 m1 p! G5 D# Y- w. C- V
  83. module_param(bcnt, int, S_IRUGO);- @3 j; `4 ]  a3 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, h" _8 p/ M9 T: Z* M  P( h# I
. M6 D( Y2 O# u3 {; l9 t7 g1 T& u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 `+ m& t  ]. t  r, Z+ ]' Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  q9 m% {$ m- g2 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% V5 ~6 s! E$ I* a! ~8 t( O1 d/ G1 L
9 k( `9 r( `4 r* g, Q) [9 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 06:19 , Processed in 0.040680 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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