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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  {  C; y# x9 t& o, k) }
  1. [code]EDMA sample test application
    8 `& [) F) }! |
  2. /*
    & P- t+ G! W3 [4 l" Z, H
  3. * edma_test.c7 W1 e  m/ m+ ?! d$ m! q0 t, l
  4. *
    5 G5 o% L& N' @& \2 a; {4 H; T/ R, {
  5. * brief  EDMA3 Test Application+ ]+ h4 \7 `  e; ?
  6. *
    4 y6 x2 u$ D  S# @5 W& V
  7. *   This file contains EDMA3 Test code.% A& m: T; Y0 N4 ?) P$ @
  8. *$ D: a' q  [# E( j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' W, j# l+ ~, i: ]5 R: o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % e5 B5 b5 }$ M, H' K" d
  11. *         TO CHANGE.4 `) Z5 d2 F+ A5 [# L1 O
  12. *
    5 N: u9 s1 ^1 D+ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) ]- x! n8 ?, T$ j- R, Y1 F0 Q# u
  14. *
    ) C' V2 W/ y/ P9 V2 p) Y. s
  15. * This program is free software; you can redistribute it and/or0 W& f0 w6 g7 u' a# z
  16. * modify it under the terms of the GNU General Public License as+ e, T& I+ q4 K
  17. * published by the Free Software Foundation version 2.) F$ x# Y3 \$ }
  18. *
    ( ~- [, ~/ D, S0 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ `% ?2 `3 d& s5 e
  20. * kind, whether express or implied; without even the implied warranty
    0 X( N  w0 P( f  t# \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 k: ]! {9 G/ ~% }  A# j4 u
  22. * GNU General Public License for more details.
    4 W  G) B% G+ v+ k# g1 S  p
  23. */
    3 G8 _8 ^, f8 a2 m) `
  24. * ^, h) S; g" B) i0 Z% C
  25. #include <linux/module.h>
    5 o( p! e2 u$ G. W8 v/ v
  26. #include <linux/init.h>! _" n% [) N! b) R1 ^" L1 h6 c
  27. #include <linux/errno.h>7 n; z7 \7 D! q1 ]6 d) F
  28. #include <linux/types.h>
    3 h- X/ V! Y8 ~/ \
  29. #include <linux/interrupt.h>
    & {, O7 j, O/ R7 V4 v( e
  30. #include <asm/io.h>8 o, p8 O; o6 A2 b
  31. #include <linux/moduleparam.h>4 p" m2 V  V- I5 r
  32. #include <linux/sysctl.h>. C/ B8 d7 _0 z) N# ]8 _
  33. #include <linux/mm.h>, T! P) l, q3 v4 K' o3 \
  34. #include <linux/dma-mapping.h>( @6 W& U% l* A- c( S+ c/ S# g

  35. 0 ~" C8 @6 |& f
  36. #include <mach/memory.h>1 k; O# @6 K  Z" U. ]
  37. #include <mach/hardware.h>4 p0 ^9 c4 W  t- B+ O
  38. #include <mach/irqs.h>
    2 e  K7 ~# D. g- K+ `% W5 {0 n% u
  39. #include <asm/hardware/edma.h>- r6 n% Q$ {+ a9 [  {% g1 A# ]" t8 Y
  40. 0 ^( m& P/ I, A. ~
  41. #undef EDMA3_DEBUG4 j! E  @( D' G$ I% H/ o6 w
  42. /*#define EDMA3_DEBUG*/
    ' W- e8 Q- L& v7 G

  43. 4 j5 h) W% d* J" U! a2 l1 v
  44. #ifdef EDMA3_DEBUG
    : C$ l9 @* e. {) u# Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # h2 B' M' m: ~* l3 E8 R4 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 ?+ B/ ~/ P& o+ N( w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' R( i9 d, L* k" x) \) w
  48. #else
    . R% V, Q! c' \6 T
  49. #define DMA_PRINTK( x... )
    % o6 Y" M: F/ a& ?$ |0 E: b
  50. #define DMA_FN_IN
      m5 m/ h0 Q( Q+ F, o6 l0 T
  51. #define DMA_FN_OUT
    2 d# N1 m  k% q0 P' i7 c$ O
  52. #endif7 K2 K! T! A/ ^! D1 F& e
  53. 7 T: c. e4 h: i# Z3 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : D4 t9 ]9 L) @+ {7 o# P: D
  55. #define STATIC_SHIFT                3& q4 X9 g# y  S* G
  56. #define TCINTEN_SHIFT               20
    - l0 ]; t6 k- x. U. u" j
  57. #define ITCINTEN_SHIFT              21
    % M8 m' M1 [3 g7 b' L0 k
  58. #define TCCHEN_SHIFT                222 M  w+ F/ M; ^3 U' N
  59. #define ITCCHEN_SHIFT               23
    . z* V3 s: Y) ~1 _/ l

  60. & O) J6 Z' ^! t% ^
  61. static volatile int irqraised1 = 0;
    , L" R" H3 @+ K% J7 K. N4 F
  62. static volatile int irqraised2 = 0;7 Y4 J0 \3 n$ @( {' V% d4 [
  63. . }' r& n, N; @9 Z$ o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + R( t9 ^4 X, [. N, p* x* i/ f1 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 s* v: {1 m. \6 Y, o: V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  r0 c; |2 h0 I* M. H+ S

  67. ; w4 i) N6 K- N# \) R- ?
  68. dma_addr_t dmaphyssrc1 = 0;! a4 o0 |: a. X. c0 v) X( ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ! ?  s/ b& t: n8 R  n- L, w
  70. dma_addr_t dmaphysdest1 = 0;
    # z0 f' M$ G4 |! h. X
  71. dma_addr_t dmaphysdest2 = 0;( s1 O6 H9 {$ x, V9 H9 ^
  72. ; s# U8 A# g3 w8 a3 n5 E. P
  73. char *dmabufsrc1 = NULL;
    4 l' Q% a  E" F* h( A
  74. char *dmabufsrc2 = NULL;
    % d8 k- g# u% m' s
  75. char *dmabufdest1 = NULL;
    , G* _8 A2 S; P1 l
  76. char *dmabufdest2 = NULL;
    * q5 u: @% ~3 p1 T; z1 S; X

  77. 1 H/ m7 J+ ^& @5 W7 r$ J3 {
  78. static int acnt = 512;0 w5 |9 f3 {5 O8 h
  79. static int bcnt = 8;; ^' y# \8 x: m+ u% D" Y$ p2 b* x4 E
  80. static int ccnt = 8;
    ) r9 u/ |$ s; Z% ?! h

  81. " l0 U; T3 d7 B- F( Y/ M, q- u
  82. module_param(acnt, int, S_IRUGO);
    4 h7 R; |  H/ i; d( G' i
  83. module_param(bcnt, int, S_IRUGO);. h9 x: \0 t+ P$ _: M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' q/ }+ a" v1 t: V: S& X4 w- ^9 Q/ B$ L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 |/ x: p9 t& j9 ~1 P4 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# a9 ^8 O* D$ u# z. @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# y) |1 H+ f% l7 o( H! z, d1 d& L/ g/ I  J4 h! d& {$ E# b

2 j9 X+ f" y7 `) s7 H( F$ v1 V7 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 17:20 , Processed in 0.046253 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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