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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! k0 ?* _  t! [8 D) O( j0 D
  1. [code]EDMA sample test application
      V2 [6 ~) m8 m5 N
  2. /*9 M3 K( S$ k/ g
  3. * edma_test.c
    . G3 x; x1 s8 j
  4. *
    0 `7 i* ^2 H" [2 |8 {% }5 G% a2 R: f/ @4 i
  5. * brief  EDMA3 Test Application& [9 Z0 {. A- H
  6. *
    2 B% P( ?' j2 I' U( \: J
  7. *   This file contains EDMA3 Test code.. o: m" v# H/ y) l, x' R, m
  8. *
    - \7 k) e( r2 B0 f  I9 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ p2 b, f. D) N# Z* S$ ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, P% A& W) b2 d6 h8 k  K& {" B$ @
  11. *         TO CHANGE.% G/ [& E) T4 A* u
  12. *
    % n3 d, }$ x2 I; t; H0 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ~7 B2 o3 t" k; l
  14. *
    7 s% n/ K" T" h& m1 ?, n' K% F
  15. * This program is free software; you can redistribute it and/or& t1 n9 E$ ^+ T1 b9 v. T
  16. * modify it under the terms of the GNU General Public License as% x0 `1 x  b% M
  17. * published by the Free Software Foundation version 2.
    7 U6 U8 |4 K7 w! U/ y
  18. *
    6 w( |4 ^" `: q, M+ _, l  C0 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; S2 v; _# K; {  p5 [: c
  20. * kind, whether express or implied; without even the implied warranty, g$ L# x6 F) }0 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 s; ~" N; Q# z, H1 D; q
  22. * GNU General Public License for more details.
    , [' s- d8 K( R' C) n
  23. */2 r( `9 P% P, V9 i. t  G
  24. * P" z- b! L- l: r) x& L9 @
  25. #include <linux/module.h>
    3 w8 @- @7 n5 H5 A
  26. #include <linux/init.h>  p7 V. d" b1 H) X1 u& ?
  27. #include <linux/errno.h>
      b6 t5 K- X8 b* e
  28. #include <linux/types.h>
    # W$ y% m% B3 q, J2 A) ^
  29. #include <linux/interrupt.h>8 ]9 H) Y2 A) E
  30. #include <asm/io.h>' f$ G- ^4 O0 T- v6 L7 S
  31. #include <linux/moduleparam.h># f9 z9 B3 c, z, x5 I
  32. #include <linux/sysctl.h>
    , S' F2 \2 a0 D7 G' o. {
  33. #include <linux/mm.h>( Y$ ~1 Y. y" t4 R
  34. #include <linux/dma-mapping.h>
    / X6 h3 S! E# _- _3 D

  35. " `! Z2 n0 Z; h. @. c
  36. #include <mach/memory.h>  o, H, s. |6 \/ s. i' `
  37. #include <mach/hardware.h>
    & J# P- f3 [6 `( i5 @
  38. #include <mach/irqs.h>
    ; Y# ~7 r- j2 G: G1 E2 ^
  39. #include <asm/hardware/edma.h>
    * O0 g) w% C. f/ K/ H- k

  40. 9 u, m- A0 B) T9 A5 D! h6 L
  41. #undef EDMA3_DEBUG
    ) n6 b. U! f0 T4 h) w* ~
  42. /*#define EDMA3_DEBUG*/7 Z2 o- I, t( j

  43. 9 [6 U' `5 G4 _3 x( c' b
  44. #ifdef EDMA3_DEBUG, a4 q; G9 }( [. L) Z8 r9 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* w9 p9 g7 r% g, W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % G( S/ _, y4 s: E: o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& H. o& ?9 b1 i
  48. #else
    4 |7 k$ W, d* U* t4 }
  49. #define DMA_PRINTK( x... )
    ' o2 O" _/ U, N5 P  ~- R3 l3 W
  50. #define DMA_FN_IN* L: _: I9 a( q% Q3 Z
  51. #define DMA_FN_OUT$ b) ^8 t2 i, x
  52. #endif, j/ N! b# t0 d4 B/ L
  53. 2 p& o* a- R9 j4 c3 D5 |( d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! B( q6 F4 S9 T- u% O
  55. #define STATIC_SHIFT                3
    ) P) O5 x2 m4 i# O  ]: _; H
  56. #define TCINTEN_SHIFT               20$ F& u' v9 E( ?! Z2 b
  57. #define ITCINTEN_SHIFT              212 s8 f& l" ]/ b5 L$ E
  58. #define TCCHEN_SHIFT                22& D# y6 I0 u+ u! I
  59. #define ITCCHEN_SHIFT               238 p# Z+ s- K3 M" Q2 k' \' X9 P
  60. / z2 T; H1 J0 R% ^+ g% K
  61. static volatile int irqraised1 = 0;9 ]. D$ T( {" h! m: Z, ~0 W1 L! @
  62. static volatile int irqraised2 = 0;* K7 Q+ n5 |3 ?7 q$ e5 U7 R
  63.   m- {9 q: F! m; T6 Q6 n- E: ]- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! y$ [6 q7 Z* ]1 w( r% Q& P) h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * p) M* F# z- K2 @- [# V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 f6 [  b$ b6 I* r5 U

  67. ( P% d$ P4 J7 \8 u" p, d
  68. dma_addr_t dmaphyssrc1 = 0;; p( |8 {4 F' x
  69. dma_addr_t dmaphyssrc2 = 0;
    + M, u! [; l6 ]9 T
  70. dma_addr_t dmaphysdest1 = 0;
    ( q: T% I, ^! T& l  j
  71. dma_addr_t dmaphysdest2 = 0;+ C8 O$ ?% ^. t; p
  72. 2 \' C3 k' f  d1 U5 g- f2 I
  73. char *dmabufsrc1 = NULL;
    & @2 A$ |- O0 n! M
  74. char *dmabufsrc2 = NULL;
    6 E6 r8 J. j# U4 N& e- `/ R
  75. char *dmabufdest1 = NULL;4 K8 t8 {. w# K% w5 L9 |" |
  76. char *dmabufdest2 = NULL;
    + B2 ^$ P8 g3 L8 |3 e4 q

  77. : v' @# `5 e* l" r6 d4 ^  h, ?2 u1 q
  78. static int acnt = 512;- U' g# T, c' G  U
  79. static int bcnt = 8;
    ; a- I# B% T+ ^7 M% D4 o! l/ @
  80. static int ccnt = 8;: f  ^( o6 {8 S0 g  P' S
  81. ! z4 L0 I5 ?$ s5 m/ H
  82. module_param(acnt, int, S_IRUGO);# M" r: k4 l7 _* j8 b9 T
  83. module_param(bcnt, int, S_IRUGO);
    " }% W5 h0 ?; m3 P' |+ m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 a) i' Q) }" K; E+ P
. H6 o3 Q) e+ W3 R  S& F) ~" h2 W! Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: O/ V- N# Z1 l: R8 r; k. [- a* Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& w( D" p1 V) A0 Z7 J2 A5 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; a9 U2 y  g7 V' H2 N* S! P

8 Y! |, p9 C7 z. ^
8 V8 p, m0 ]) G& c4 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 11:35 , Processed in 0.037750 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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