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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z- b; T. W7 s% D# a* w# z
  1. [code]EDMA sample test application
    7 a4 ]% R9 H5 Y5 h! ?9 l$ D6 L
  2. /*0 U+ J. T% ^* f: l, x" {" c2 E$ y
  3. * edma_test.c
    ) O$ B7 N5 P/ K3 b
  4. *
    . s& A  e$ `8 y  @
  5. * brief  EDMA3 Test Application
    % A* P* Z. x1 A1 Z
  6. *: n9 ~' J4 Y  \6 N# G3 |
  7. *   This file contains EDMA3 Test code.. [" D  ^' x* Z$ B- O  b  q5 s8 ^1 o
  8. *$ y" @% s) Z/ m' y2 d- {0 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " k4 \3 v. f- K. E: O  y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% k# e+ x! o3 u9 U0 w* s2 H
  11. *         TO CHANGE.
    ) r% X" H3 H  X! o" p! T
  12. *
    $ n, j; p3 i+ F. H  i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// N  D2 Z# h+ n
  14. *3 ~' p6 N: R0 R% d1 ]% d
  15. * This program is free software; you can redistribute it and/or
    6 @) Z5 h/ v1 Y- g
  16. * modify it under the terms of the GNU General Public License as# m3 j2 n6 P" t/ W0 @
  17. * published by the Free Software Foundation version 2.
    # Z' s2 o  o2 m, U2 S
  18. *
    # z- v% z5 o% j9 g; o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" H7 J1 z! G" _6 r
  20. * kind, whether express or implied; without even the implied warranty
    $ }4 ]7 ?- T  [( n' L0 q( G& ?- B3 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: N9 f) C6 y6 z/ C; [* w$ [
  22. * GNU General Public License for more details.. M4 x. M" t+ \  ?5 Y, [
  23. */  t# L2 i9 y( E+ j9 f

  24. 8 B8 C- `( A1 z; i
  25. #include <linux/module.h>
    4 }  B, U8 h8 t* P* K+ Y2 v: Y0 o
  26. #include <linux/init.h>
    . S/ H& [" }- L. c
  27. #include <linux/errno.h>
    6 z3 t6 n/ k" D, N# O; ]; X
  28. #include <linux/types.h>" U6 r, D8 u6 }  e
  29. #include <linux/interrupt.h>
    " `$ M+ ~1 M' u
  30. #include <asm/io.h>
    # ?& P3 {9 X/ F' g! _6 h. j
  31. #include <linux/moduleparam.h># g- S7 x) ~8 Q- f+ \
  32. #include <linux/sysctl.h>
    2 A7 b% l, \1 F/ K, z/ a. L& E
  33. #include <linux/mm.h>
      a+ }% n& h  \' Z( |0 g
  34. #include <linux/dma-mapping.h>* G5 i$ N8 R' ?! E1 d

  35. : u: G7 R  e$ q% d& l( {' d
  36. #include <mach/memory.h>
    . n2 D$ b5 s$ ^/ X, D
  37. #include <mach/hardware.h>
    # ]9 c7 z) i3 V  @
  38. #include <mach/irqs.h>
    6 q4 S. u$ }" L2 H3 ~
  39. #include <asm/hardware/edma.h>  e( h+ T5 O: h* k3 S: D

  40. ) a( R6 T) b; j- ]8 D6 R) Y" z, j
  41. #undef EDMA3_DEBUG
    - ~- w! p; Y/ ?
  42. /*#define EDMA3_DEBUG*/7 T) N$ e+ m5 y9 Y
  43. ' s+ o5 r5 m  S! F
  44. #ifdef EDMA3_DEBUG" I: h* O4 b" q7 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + y, W$ A3 h, W$ l! j7 p! w8 U# i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; e2 y7 s) w- q1 q7 V, I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 n5 v4 C, E" f0 e
  48. #else, U3 A- o$ A2 Z1 M& L$ F! S
  49. #define DMA_PRINTK( x... )
    " M% Q' y, S% B6 b& B$ P; j
  50. #define DMA_FN_IN
    . T4 e6 d* `% e4 b3 ~! X/ U
  51. #define DMA_FN_OUT
    . A* l3 c& a  E6 }5 D, y
  52. #endif2 y  F& G, M! [

  53. 0 L- @  b5 N! e! r( _, \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; F/ w2 q6 Y6 v6 l  H3 ], ~0 l
  55. #define STATIC_SHIFT                3. t- l1 M" x2 ]0 {0 ~' {" C2 o3 c/ t
  56. #define TCINTEN_SHIFT               20
    9 `2 F* Z( ?) W: q- q3 \: A' D
  57. #define ITCINTEN_SHIFT              21) V& d3 J' N& W: E9 v) F
  58. #define TCCHEN_SHIFT                22
    ! M$ j5 r+ }& ^% l, b; P0 B
  59. #define ITCCHEN_SHIFT               23
    + u! B8 |7 X; v! w3 J$ c2 C# u

  60. 9 E+ M* F7 A* Z9 R6 H# a- l# B
  61. static volatile int irqraised1 = 0;$ M! j, T4 M' ^0 {! j
  62. static volatile int irqraised2 = 0;
    3 L0 M8 z* @! T9 M1 z5 P2 h# s+ b
  63. 6 x' u0 H' n. y5 S' b0 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Z4 G- B2 ~: S( @9 Z6 b7 d0 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 N0 b  }/ N1 O- A. D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 Y( C( h& S* x% O
  67. & z7 O' d2 r! W5 u0 p
  68. dma_addr_t dmaphyssrc1 = 0;; b' M/ V" h9 |( a* Q. ]; x
  69. dma_addr_t dmaphyssrc2 = 0;
    $ }4 \2 I% k; B( U  s
  70. dma_addr_t dmaphysdest1 = 0;
    : d1 i& R, q8 Z9 A6 C) x
  71. dma_addr_t dmaphysdest2 = 0;
    , ^! ?2 Q5 L) @( e  `/ `

  72. . ?; l9 [# q% n$ G8 ]/ y
  73. char *dmabufsrc1 = NULL;
    ' e  J3 g3 }/ x
  74. char *dmabufsrc2 = NULL;
    2 K8 p, A: C5 p, ~6 j' A" f( z1 R
  75. char *dmabufdest1 = NULL;* R9 F2 I1 O5 x
  76. char *dmabufdest2 = NULL;1 l; C7 i/ q3 A) c: o2 o$ R9 P

  77. : }$ r* Y6 E' f3 N
  78. static int acnt = 512;+ Y9 p0 o6 C- l$ M) l5 T% O9 }
  79. static int bcnt = 8;3 ~# W, S2 F4 G
  80. static int ccnt = 8;9 H& c8 Y5 h+ e, B
  81. 3 [" D7 ]$ o8 p- G
  82. module_param(acnt, int, S_IRUGO);
    # r  `" |0 U- R1 I- \6 {8 y
  83. module_param(bcnt, int, S_IRUGO);
    % K" k1 P& e7 V5 d. g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 m: I5 q" l% d6 N  U9 a: b6 N
, f4 @4 Q" _" }# \6 B2 h, H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 P, f' S7 N& D; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# s5 d4 l7 ~; H6 a1 S" v1 `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! |. Q/ ]- o1 ^2 x

0 Q$ m! Y2 a/ Z- v/ R3 {0 s3 ]2 K/ ^2 F3 t7 s: H' V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 18:49 , Processed in 0.043769 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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