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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , X  @$ H% G2 O" H- {4 C6 P
  1. [code]EDMA sample test application
    1 O9 ~, a$ D. V
  2. /*2 o) }$ ?$ Z" R' O% H3 d& H( M
  3. * edma_test.c7 `7 F' l: o, u& a; m7 g+ W
  4. *
    + e* U4 j+ k9 f" i7 f! y3 n/ D
  5. * brief  EDMA3 Test Application
    ' a* }8 T5 O3 C. i7 {
  6. *9 ^' G% S, Q2 L( r! [( e- S* I  p
  7. *   This file contains EDMA3 Test code.
    # V  x! k0 h+ a4 B$ z, U! T& @
  8. *
    4 \5 f/ c) L# ?) d# A- ^7 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( c4 }! X9 h3 j* R9 O9 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 @* ]9 {" b& {" w: Z: F# v; l
  11. *         TO CHANGE.
    5 v/ c( w( Y# l# L. x1 j
  12. ** u  @# e( v% s7 B" d9 a# E( P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " c' N) U- G8 X( ^/ ]
  14. *$ l0 J% _; e9 o
  15. * This program is free software; you can redistribute it and/or
    ( ^* w3 E: h7 S+ H8 k5 H# p$ _* x
  16. * modify it under the terms of the GNU General Public License as
    1 ^# s: J( D# C
  17. * published by the Free Software Foundation version 2.
    2 b; D& |0 T3 A$ B2 y* ]' v
  18. *( g3 y$ K1 P( a% d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ V7 [# w: j" y6 t8 s. Q; C
  20. * kind, whether express or implied; without even the implied warranty0 `2 X+ [7 q& \+ V* q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, F+ }- {8 O, X: U0 v8 q5 a
  22. * GNU General Public License for more details.
    $ m4 G- T4 P1 [
  23. */
    7 a2 @/ Z! L( O, f

  24. 3 N) a1 J5 _; E/ b! @/ W% P3 s8 |
  25. #include <linux/module.h>2 c- {% X2 g1 R1 L' I' v4 E* M
  26. #include <linux/init.h>4 M+ X" E& B, D2 D
  27. #include <linux/errno.h>
    8 b! `+ |: S2 o) @2 t
  28. #include <linux/types.h>- x7 |; d) H: f) O9 k1 q
  29. #include <linux/interrupt.h>
    ; r' ~8 T, @" j& A
  30. #include <asm/io.h>
    3 Z$ r' q( q2 v$ F& E* _' S; H! U* |; W
  31. #include <linux/moduleparam.h>, i3 z1 k1 l7 T, I& m
  32. #include <linux/sysctl.h>0 ~) J: @) p* o8 H: V
  33. #include <linux/mm.h>
    . ]- g  |) O% g3 j: V
  34. #include <linux/dma-mapping.h>
    9 E0 x& J2 j2 c  B" q5 n
  35. 6 v" `, s! z4 q" P; M6 o6 }
  36. #include <mach/memory.h>
    + _: A! @* R7 ]' P
  37. #include <mach/hardware.h>' x3 t! f5 ~* t! _, g7 b
  38. #include <mach/irqs.h>
    0 x# u* r) f5 r( V5 ?
  39. #include <asm/hardware/edma.h>" @* @; L' E( j# d$ K2 G

  40. 7 P5 I! D/ i7 R
  41. #undef EDMA3_DEBUG- s3 M) f  L+ [; Z
  42. /*#define EDMA3_DEBUG*/* T. z* a/ S# ^8 {5 T" H! E5 B

  43. ! j9 B& s9 c7 a3 r! n$ }- s6 p! m# s
  44. #ifdef EDMA3_DEBUG
    ! j* u, M0 @/ K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ j! Q9 F, z0 m; v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      @" _* B7 h# p/ @' A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 V7 y, J  j& |4 j4 c$ v3 d3 M
  48. #else
    7 T2 x) t3 \; k" _0 n5 r' S
  49. #define DMA_PRINTK( x... )
    ' h1 ^" t, \- _; n- m
  50. #define DMA_FN_IN- x" ]2 z% c2 \$ z- a$ ]/ n) \1 J
  51. #define DMA_FN_OUT7 K8 y4 A) L& {( z6 n! [/ r" ]
  52. #endif
    . r1 Q. V* n# q; K, m, K4 l/ E$ S

  53. ' @( D) B' X$ J0 G+ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* P, @# P7 P0 t
  55. #define STATIC_SHIFT                3+ g8 V. _# O" k, L
  56. #define TCINTEN_SHIFT               20
    - r% d0 B1 F7 o4 \1 }8 U5 b0 G
  57. #define ITCINTEN_SHIFT              21
    ; R* x; ^& G2 S( q7 u& |8 w0 X
  58. #define TCCHEN_SHIFT                22( M1 ~. R8 \+ y% Q1 \9 v3 C0 I; f6 g
  59. #define ITCCHEN_SHIFT               230 y$ K  T8 I* @  u) g
  60. # Z8 a0 D. b$ W2 f
  61. static volatile int irqraised1 = 0;2 M% X9 D; n9 O" I
  62. static volatile int irqraised2 = 0;4 H9 U( G3 R4 Q; y; F8 ~2 S4 @

  63. 2 @9 Z& i" s( A! [* L& ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 J* Q. r  h  |6 d1 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( V5 C! G7 `& ~( {# e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - b  P0 Q& v- o, q6 b% H

  67. ( ?6 a8 B2 k& J2 y. R
  68. dma_addr_t dmaphyssrc1 = 0;6 O2 k, ~+ O4 z$ {, X; f# e
  69. dma_addr_t dmaphyssrc2 = 0;
    5 R0 P/ x; T' C' {. M" h1 f
  70. dma_addr_t dmaphysdest1 = 0;
    + h5 K; }5 o) K8 |
  71. dma_addr_t dmaphysdest2 = 0;$ b5 D: @( y& U3 w* e# H2 m
  72. - t, g1 H6 l; k
  73. char *dmabufsrc1 = NULL;- f4 ]$ O0 f$ P) |0 }; T1 u9 Z9 B. n
  74. char *dmabufsrc2 = NULL;
    6 N. A1 u, r; N% v# x
  75. char *dmabufdest1 = NULL;" B/ {3 L5 W' z4 V
  76. char *dmabufdest2 = NULL;
    * q% x5 k( c+ K1 S

  77. 8 a! w$ V0 w7 C; [* [! [% h
  78. static int acnt = 512;
    & K& ?. g, `; |
  79. static int bcnt = 8;
    3 D( |0 T; C' O; n& C1 Z' X
  80. static int ccnt = 8;
    & _2 T7 ^7 s& \) a% j, a

  81. 2 F, s! A6 e- d4 ^0 Z- m' u0 Y
  82. module_param(acnt, int, S_IRUGO);' t( ^' v, M' c$ v9 ~* ?
  83. module_param(bcnt, int, S_IRUGO);# f+ ~& r9 Y% r4 v5 L1 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# E  W# ?1 O9 E! {. D* R; g, `. e6 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Q2 g2 p5 w0 R1 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, h8 |, J( R. x3 ~- u( `- B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( h& O3 X' Z0 T( ?0 T+ v' c4 r! u4 ]$ ?4 F8 p! h" \, y0 i
  q' x* Z: q5 k: o( M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 06:06 , Processed in 0.040005 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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