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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 L7 J  R. V  ]& r  y  l5 T% G
  1. [code]EDMA sample test application' u# R$ @$ _6 J) `$ x! f
  2. /*
    1 ~3 B2 I2 e4 ]; F; b9 s
  3. * edma_test.c5 d+ w, G2 o. u8 y
  4. *
    2 X; a4 a6 Q( U; `, d* m6 b% b1 P8 X
  5. * brief  EDMA3 Test Application
    + n  }3 C; e/ Z. v1 [2 B2 I
  6. *
    0 A9 H# C" I: o- D, U* I1 P: W
  7. *   This file contains EDMA3 Test code.
    & \" H3 V( k& l* h+ [6 w3 l" `/ c9 `9 z
  8. *
    & ^$ D7 i2 F8 j: B: G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 p, Q* N/ R& y$ i+ w1 X; a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 J1 h; _/ W! `+ _* T; l
  11. *         TO CHANGE.
    8 S3 Y( |% q5 O" h
  12. *
    " Y! a9 w) j1 q8 A/ l) ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& I9 z7 ^: a4 L; G. N2 c
  14. *
    # v1 s6 `4 h! {, J* W3 j  B
  15. * This program is free software; you can redistribute it and/or
    3 a/ v  J9 C+ g4 ^  ^
  16. * modify it under the terms of the GNU General Public License as8 b9 M1 v  u, p- x: o
  17. * published by the Free Software Foundation version 2.
    ) m0 L7 S% y* M8 v3 w8 h
  18. *
    ! Y$ i. J1 a7 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 }' W; j' c$ o% r  p( f$ o  a% E
  20. * kind, whether express or implied; without even the implied warranty
    " Q' y- `. _+ p9 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 J& ~, l% ?7 J/ m+ u" U
  22. * GNU General Public License for more details.2 Q! X' D# |  f
  23. */5 B. E1 ~  b" n% `8 W, }2 U( X" ^
  24. % F2 H* I8 L0 `4 }4 M
  25. #include <linux/module.h>) L0 _2 k' p& B5 Z2 f  T# s
  26. #include <linux/init.h>( ]' L% N- V5 N. f1 @& i
  27. #include <linux/errno.h>
    3 E) ^+ O/ b8 j" P% }# k, C9 y7 H
  28. #include <linux/types.h>
    2 p2 |; V# `. ^
  29. #include <linux/interrupt.h>! L$ j! K' X9 Q/ q) [1 I9 F6 @; y
  30. #include <asm/io.h>
    7 G( o( V2 {% V# t3 |0 |" Q) N" O
  31. #include <linux/moduleparam.h>; B$ l- W0 B: m4 u
  32. #include <linux/sysctl.h>7 [3 g- c& M$ b' H
  33. #include <linux/mm.h>& I3 g5 V( _! m
  34. #include <linux/dma-mapping.h>
    ; r& {9 S$ P5 H: j

  35. $ B: v) p) c6 I
  36. #include <mach/memory.h>
    . q4 S" m- `* @. V1 Y
  37. #include <mach/hardware.h>
    1 i  O. l8 Z3 e5 g; @* |
  38. #include <mach/irqs.h>
    2 k! t) U" `% p
  39. #include <asm/hardware/edma.h>' X1 s: {) F* @" ]! x4 k
  40. 2 [0 F) q' }# Q
  41. #undef EDMA3_DEBUG
    8 e( ~- _4 A& W6 |
  42. /*#define EDMA3_DEBUG*/( V" I  t3 a; K7 f
  43. 5 u) s; Z- U2 |/ ~1 w
  44. #ifdef EDMA3_DEBUG
    5 m" W0 g6 S1 I  X" Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 ~$ H: T0 x2 d! V& l  F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% X& L6 Q) T- S( @; w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 k4 Q4 g7 P2 e$ I; m1 W% S" ?$ f8 p
  48. #else
    2 `) p* [# ~, u( `& B' q0 Z; U
  49. #define DMA_PRINTK( x... )3 G* I$ Q1 t1 Q# O2 S/ {! r
  50. #define DMA_FN_IN
    ! Z- L" }8 H1 O! f& D; [
  51. #define DMA_FN_OUT
    / X7 u* E) b0 d: a& V
  52. #endif0 i3 l/ D0 \& C/ w; n7 D
  53. ) A& K, d4 R* [4 L- g+ c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 r$ s8 w! x+ ?
  55. #define STATIC_SHIFT                3
    : C+ S9 Y( l5 Q; P/ E
  56. #define TCINTEN_SHIFT               20+ D) G( E# A2 E6 M
  57. #define ITCINTEN_SHIFT              21* V) I, t0 r+ j6 E1 f
  58. #define TCCHEN_SHIFT                22
    4 f1 \- D8 q, x6 P* c
  59. #define ITCCHEN_SHIFT               234 n+ i4 E+ s, s$ L1 W  p5 y
  60. 3 o: f6 S' @7 n" D- J  O
  61. static volatile int irqraised1 = 0;/ }5 {  B/ X: h9 o- t
  62. static volatile int irqraised2 = 0;3 y% g( U2 @# Z( P' Y% x& o: c( ^
  63. : B7 n5 |) ~8 U. m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - y( M$ V0 E2 I7 `) Y( V1 _3 u3 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , b- h; [/ o6 k! z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e# Y. z8 {* N" Z; k$ N

  67. 1 w! m# |/ C9 E  T, o
  68. dma_addr_t dmaphyssrc1 = 0;" }1 v' U$ P2 B  ^/ S# H/ K! e/ P) `
  69. dma_addr_t dmaphyssrc2 = 0;
    0 P* y( a7 M" o: y" r2 S& O
  70. dma_addr_t dmaphysdest1 = 0;
    9 n/ i$ \) y# P8 z9 Y
  71. dma_addr_t dmaphysdest2 = 0;
    / N4 _) N) ?) C- y% f$ @0 d, E# e
  72. + R. {8 _/ p9 G
  73. char *dmabufsrc1 = NULL;& f4 K) H# A$ ], }" p% H
  74. char *dmabufsrc2 = NULL;
    * d* o& Z, e+ ], C) k: S; w/ @! N
  75. char *dmabufdest1 = NULL;
      ?2 X! D( u4 O
  76. char *dmabufdest2 = NULL;
    : K  D# V8 W7 ]% l7 G5 V

  77. * G9 m6 [5 X) H5 k8 J! _* L$ N
  78. static int acnt = 512;
    7 L) h6 p. t6 l0 Q
  79. static int bcnt = 8;5 l  C- V. t" R. m8 K
  80. static int ccnt = 8;
    . W5 a0 }& c0 @" m

  81. ) v  ^1 V: ~. O( z4 j
  82. module_param(acnt, int, S_IRUGO);$ h/ u# H! `/ d$ V- \! o
  83. module_param(bcnt, int, S_IRUGO);
      {( }* f- Y% i  ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: z# i4 m% r+ G" g$ z1 M
+ h+ K3 @" [* b7 Q% k3 F7 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ I% Q, h7 B! ]8 F$ N0 f& L, [" ~- J
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: M! a9 G! O% {' i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 a9 T3 \$ G3 ?% B6 n. l
7 ~( x) o' h, r& v& D
! D) q+ U4 l9 U2 b9 y7 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-26 02:13 , Processed in 0.044645 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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