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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  S/ u! i2 @+ @: i5 [! ]
  1. [code]EDMA sample test application$ W: s+ H8 P  o8 |6 _$ E7 h
  2. /*
    9 _8 w8 {. \" K9 T- a
  3. * edma_test.c* s6 A; k- p, u  h
  4. *
    6 Q$ D) R/ n, l1 R- Y0 l2 w* v
  5. * brief  EDMA3 Test Application
    * C1 P; O/ ~3 |% k. [6 h
  6. *' \/ v! d) @$ z2 }9 U- d5 U
  7. *   This file contains EDMA3 Test code.4 a4 S2 g; I0 f' H) i7 s
  8. *
    . }' o9 r: w5 w  X; f) ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* q# _1 f  s1 x2 l$ ]- U2 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ^: y. g+ E+ K0 W# P! @
  11. *         TO CHANGE.
    4 b+ q; K9 H, r% t, s
  12. *4 M2 O) X" @9 b& A& n: k% l' {  B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ h, M' [3 Q/ a5 A5 B- J( Z4 H% Y8 V
  14. *2 T; \: D5 a$ k! [' t7 s
  15. * This program is free software; you can redistribute it and/or8 B5 S% {2 T! i* p
  16. * modify it under the terms of the GNU General Public License as$ ]( ~+ \) G" ~* o+ ^; a& W+ a
  17. * published by the Free Software Foundation version 2.
    & W  d+ s5 L) ]* L" R
  18. *
    - h/ c" u! `0 ]# v8 Q: Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; D5 W  ]1 i1 W  d
  20. * kind, whether express or implied; without even the implied warranty
    ! J+ ^& Z, k" m0 H: V! C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* l, v! F+ \+ X; ~- _! t1 F
  22. * GNU General Public License for more details.9 I- ?3 C0 R* @4 a6 g
  23. */
    $ ?- q$ L  k" `& N; u4 g
  24. - O: [- H9 z  @9 W: U' D6 J
  25. #include <linux/module.h>
    . S4 ~& {( _# U# L, p
  26. #include <linux/init.h>
    0 m5 s) J+ A( n5 i6 M5 j9 O+ w
  27. #include <linux/errno.h>) G3 s9 v# C9 }* }, D
  28. #include <linux/types.h>
    2 Q! \  p: `0 [& n
  29. #include <linux/interrupt.h>  V# f) v' q+ C: D0 I
  30. #include <asm/io.h>
    , I4 |1 [+ ^7 p" Y7 P
  31. #include <linux/moduleparam.h>
    * X: B7 k8 n- P5 |
  32. #include <linux/sysctl.h>- E: m7 S  D0 T' a' n. n
  33. #include <linux/mm.h>
    % ?" z0 V2 T. y5 O
  34. #include <linux/dma-mapping.h>
    $ ]6 k5 [6 s0 {) N* T
  35. # y. A8 C+ d% i4 B9 u
  36. #include <mach/memory.h>8 W5 Q# e. \+ p+ U6 R# ~- v
  37. #include <mach/hardware.h>
    % }9 S: A' |; Z! `& ?2 O
  38. #include <mach/irqs.h>
    % y0 o% w1 D- r: h1 Y& a) s6 F/ N
  39. #include <asm/hardware/edma.h>
    1 R( V9 h1 u8 d* t

  40. " H' X0 Z% U  k" Z+ P" I: C
  41. #undef EDMA3_DEBUG9 D6 r0 [+ v$ a* i" E
  42. /*#define EDMA3_DEBUG*/' I% H  C! X7 ~5 ^$ b
  43.   ^" |4 a/ ]  n- p. ^/ X$ b7 ?
  44. #ifdef EDMA3_DEBUG: K9 n9 K& W" g# h& b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' h6 P8 n. s4 W' X2 T$ c8 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 i: f/ J1 J4 {4 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( i" X7 ~, A( |
  48. #else
    ) r2 [1 }/ t0 ^: u
  49. #define DMA_PRINTK( x... )3 a+ J+ e+ V/ O( w. t4 G; h
  50. #define DMA_FN_IN# g% v) l  D6 x
  51. #define DMA_FN_OUT
    / ?; o) [) u+ @/ O7 H3 Y
  52. #endif: r6 @+ d- F# g* g
  53. * h5 b# O; U0 N; m) E% p3 ?0 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # Z; d3 T* h# l' k" z
  55. #define STATIC_SHIFT                3
    % w4 b! k: C! x2 r6 {) J+ ~, p
  56. #define TCINTEN_SHIFT               20
    ) U% d, U1 ?! c: t3 @; J
  57. #define ITCINTEN_SHIFT              21" r: L5 C& W; W- V9 V. {& \
  58. #define TCCHEN_SHIFT                222 \7 V1 W1 I, ]4 W% z
  59. #define ITCCHEN_SHIFT               23) a! w, _1 A4 B) Z- H1 T
  60. 2 v; f# L8 r  B: j0 n' e  o
  61. static volatile int irqraised1 = 0;- k  T+ e2 ^" u% J5 Z: v
  62. static volatile int irqraised2 = 0;
    ! ]# f! k9 ]+ }3 C/ N3 F  d( O6 E

  63. 5 H( w: K' H1 C2 B* t( w' g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N1 Y8 r; G& ^$ G0 f- B( i8 _% x8 P2 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 b/ f; P4 C1 x4 G% t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# i/ z5 _5 h9 s6 H9 R

  67. ( B9 f3 Z, A* S0 c: ?! m6 @
  68. dma_addr_t dmaphyssrc1 = 0;
      ]9 [7 }# v# U/ X8 |/ \
  69. dma_addr_t dmaphyssrc2 = 0;5 p$ c- `1 L( `& l6 p5 |% K
  70. dma_addr_t dmaphysdest1 = 0;! B0 z* l8 e, \) @, U+ J6 \
  71. dma_addr_t dmaphysdest2 = 0;
    ) W- C$ ~: s. i- {
  72. 5 ?1 }' B1 `8 j( u$ f
  73. char *dmabufsrc1 = NULL;
      Z6 _( W1 b9 g! l- s, C- t
  74. char *dmabufsrc2 = NULL;, W# D0 c$ E- D5 D. `! @) Z
  75. char *dmabufdest1 = NULL;7 ^$ s. x+ B* ?8 e" H# }) b  }
  76. char *dmabufdest2 = NULL;" j) V& {/ v4 r0 V* W0 \, X5 {
  77. / Q; ]5 W% |: |6 |4 y+ |
  78. static int acnt = 512;
    7 a0 u  }5 Q  J$ @1 f5 ^7 \
  79. static int bcnt = 8;
    5 D8 {. z# c3 }) A* V' g( h" }
  80. static int ccnt = 8;7 j* Z: Z5 b' \

  81. . E" }& G2 e1 V8 }9 u9 z, |  N
  82. module_param(acnt, int, S_IRUGO);
    8 `% b9 {; W9 a( |; C8 p$ q8 X
  83. module_param(bcnt, int, S_IRUGO);7 A4 F' a% H1 \5 L. q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. f  T$ g! m. _* y$ U# h7 I; w( P6 ^. m. ~; A! U3 ~' x! ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 R6 i0 O/ I6 r: e8 v. V% [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) U6 u5 i: c7 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 w1 M- V  U. }8 h+ e6 V3 X
. c5 _! r0 r' Q* v! c' M8 k4 ^9 [; \' [) j8 o3 r  l! c  p1 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 05:57 , Processed in 0.037737 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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