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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * d- q0 w: T) {  Z( |* J2 N
  1. [code]EDMA sample test application8 ]& A8 A2 M1 d( t5 l; [3 s- t7 V
  2. /*
    % m+ Y5 ^" d" y6 O/ i  `
  3. * edma_test.c
    0 a+ P* W5 n: z
  4. *% H4 B4 K) d/ b3 S: P0 Q
  5. * brief  EDMA3 Test Application; a: O" c0 X, c' \6 `
  6. *( j# j, X) R* e% R3 y. _2 _# N
  7. *   This file contains EDMA3 Test code.
    3 f  p2 A3 N2 x( {( K! s+ ]- [
  8. *; }% W/ a% I  B1 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " ]) Z/ Y9 h/ U, E# d2 c8 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 h9 g( v7 [6 s
  11. *         TO CHANGE.- _9 x; n+ f. e: w% m
  12. *! S  w/ I+ i8 q) n' b$ t, n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& O0 m5 W6 l5 q9 C- w: M
  14. *
    ' \& w1 E" g: B9 {% e$ E
  15. * This program is free software; you can redistribute it and/or
      m8 J+ `1 e1 y4 Z3 d
  16. * modify it under the terms of the GNU General Public License as
    $ o* U1 U. ^/ A- O( q$ o( M
  17. * published by the Free Software Foundation version 2.
    2 f; X/ `8 D  R8 `* m6 x
  18. *7 f/ _2 E8 r% z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  U' Q3 t, q% W8 f. V) m8 V
  20. * kind, whether express or implied; without even the implied warranty/ m6 H" P' _1 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 |) j2 b6 R% l" \' d
  22. * GNU General Public License for more details.
    ( u) d* y9 T) n) A1 \9 i( X" U
  23. */: C4 P! z# |( W' @$ b; v9 G
  24. " p! ?; m% j. r; F) \
  25. #include <linux/module.h>4 b" M0 f  ]- x9 ~) @
  26. #include <linux/init.h>
    5 \7 E' I* e$ ^+ R2 _; L
  27. #include <linux/errno.h>
    1 P1 W  E) B/ p  f( _
  28. #include <linux/types.h>
    & V( J8 A% z4 R/ Z% ^! y+ R2 U
  29. #include <linux/interrupt.h>
      L) `. p6 m! v8 O8 D) A
  30. #include <asm/io.h>/ y: I% p  C7 ^6 |
  31. #include <linux/moduleparam.h>& o% \- K( x$ }+ F$ ?
  32. #include <linux/sysctl.h>: Q$ T4 ~" C" M  M* x
  33. #include <linux/mm.h>5 X% g! D  t) b( s0 ?0 l; _
  34. #include <linux/dma-mapping.h>: X- |: z5 F! G) Y
  35. 3 C  {9 Q# g# Z( K2 T5 I
  36. #include <mach/memory.h>; T# E. K9 W3 S& Z% b  v4 b5 ^( B5 q
  37. #include <mach/hardware.h>- y+ P/ ^/ _7 u  H. W/ m6 Z
  38. #include <mach/irqs.h>
      X' ~4 V  \' e
  39. #include <asm/hardware/edma.h>) ?; Y# N' u& f' }, F6 g
  40. 8 w4 r* W# N4 O- L2 D1 ~
  41. #undef EDMA3_DEBUG
    # F! ~# w. b' v
  42. /*#define EDMA3_DEBUG*/# F# Y: T9 q' }+ j% L
  43.   h6 G1 m* d8 f# |1 N6 J" h4 p. [
  44. #ifdef EDMA3_DEBUG! J/ u0 ~& n0 V. G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : c1 k; k5 B2 [4 N$ {' H  t0 {5 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ O. J- S+ D  c, U4 i$ b5 Q1 ^$ i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 u/ G2 i9 g8 Y* Q
  48. #else) S% m* ^2 n8 f& ^
  49. #define DMA_PRINTK( x... )
    3 ^7 i7 u  I/ [& a# j
  50. #define DMA_FN_IN7 x, e5 z1 a+ `: W( d
  51. #define DMA_FN_OUT: u% I/ U3 l1 W
  52. #endif6 f; x* Z) ~: E( v4 `. s( z2 w) e

  53. - B& Y; Q0 ^* }5 O- e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( `- v# N5 d, e3 Y1 A
  55. #define STATIC_SHIFT                32 q2 x6 @0 U% x) P" K% R; y( c
  56. #define TCINTEN_SHIFT               20; u' n9 G4 M# T- v! T6 b1 s
  57. #define ITCINTEN_SHIFT              21
    . {/ W4 o  V7 ?, \1 V6 Y
  58. #define TCCHEN_SHIFT                22% H0 e7 q" T- ?6 O$ o$ v
  59. #define ITCCHEN_SHIFT               23- \( J, c4 E0 B4 H
  60.   ]2 Z* K4 J& j4 i& r1 N: K8 {, I
  61. static volatile int irqraised1 = 0;, M8 I7 D0 \6 x7 B
  62. static volatile int irqraised2 = 0;: P7 i/ C! h: c0 k: j9 j9 F$ N0 ~

  63. 9 ~( M  N' f3 y' w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & G& I7 F+ T8 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( v5 g' J( x' o" o. y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; z& l7 h! h$ E* o
  67. ; M" \5 S# A  h0 y* ~( Z( D
  68. dma_addr_t dmaphyssrc1 = 0;3 D/ m6 R2 Q5 `. J0 \/ ]
  69. dma_addr_t dmaphyssrc2 = 0;
    , D2 B! [' R; R$ q( L2 f
  70. dma_addr_t dmaphysdest1 = 0;; @7 ^% g. @; n
  71. dma_addr_t dmaphysdest2 = 0;& n' r) ~% `% I, N

  72. , z. l8 b6 \- @) ]) P7 Y
  73. char *dmabufsrc1 = NULL;
    0 `& {0 \! R( _8 P6 N% l
  74. char *dmabufsrc2 = NULL;
    ! Z' j. t6 Z; t. t! R, Z
  75. char *dmabufdest1 = NULL;
    % T' k$ l% ]$ \
  76. char *dmabufdest2 = NULL;
    7 w) L2 J  S% w- S  F

  77. 2 t: w6 p8 p& H  v( G, e. }4 T
  78. static int acnt = 512;9 W% z) {% P  K9 n; ?% k& z
  79. static int bcnt = 8;
    5 k, d; A  v" v4 ~! g5 X
  80. static int ccnt = 8;* J0 K. h( O2 r' g. [/ T
  81. 9 Y: c' ]) e% c" z( }4 c6 A* I
  82. module_param(acnt, int, S_IRUGO);
    * y9 B( |5 P, g& t1 L2 V
  83. module_param(bcnt, int, S_IRUGO);
    1 U( B& z. U8 H8 `; Y- t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  ~8 c# x, _, A; P& S/ b  @
# A6 y/ k# n9 V+ y! A9 Y" b0 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Q! P: l# Q3 v9 E- Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  W2 }. f( a, N4 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% K1 n3 [$ N) R8 |) U

( O+ ^& p0 G8 d' v6 c) A. @( n7 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 17:46 , Processed in 0.039999 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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