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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + r  Z& v# G7 M
  1. [code]EDMA sample test application
    ! r$ c# U! ?& F; J% Y
  2. /*7 x: {( _. q! S
  3. * edma_test.c
    ! v" y4 I0 n9 y. Q6 i$ _
  4. *
    2 f# d- S. F9 a4 d8 \& F. P4 t
  5. * brief  EDMA3 Test Application7 g% C( x4 M0 S, ]  ]+ A' z/ o* e) q
  6. *
    7 @  J. N! G- a; o. Y
  7. *   This file contains EDMA3 Test code.
    9 b  c& N" i5 g. j% j6 s- |0 n
  8. *1 F2 i$ N7 I- T" [$ f! V6 R" e3 X# D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x. ^9 ]3 S. ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 i5 p6 w. X8 d, x" ?
  11. *         TO CHANGE.$ Q1 C- U; N6 Q& O
  12. *! L, ]5 |' }9 }9 M0 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* d2 w* P# ^& S' ^
  14. *
    + d0 W# K; J/ x  o$ {  }
  15. * This program is free software; you can redistribute it and/or- z) L: S; U- N9 w4 ~- J( O! v
  16. * modify it under the terms of the GNU General Public License as
    & d; G4 p6 p2 b4 B5 j1 _' Z% |
  17. * published by the Free Software Foundation version 2.. H3 a! L$ O! A; U- z8 W  i2 n
  18. *
    - T1 b- i+ J% F( X9 N6 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / a4 m5 A# T) v  Y) j
  20. * kind, whether express or implied; without even the implied warranty
    ! ?! m5 S) s: O3 n; y4 _1 b, p& g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / K. b6 u: ^: d& I
  22. * GNU General Public License for more details.
    2 s; f1 j' b+ \0 ?
  23. */
    : O* m6 ?6 _( i/ ]5 W+ r; `7 K, R# S
  24. $ O) h+ D5 A# G( E* @
  25. #include <linux/module.h>
    7 G5 G- V+ {7 D6 n3 N2 P
  26. #include <linux/init.h>7 X: @0 I* O, H/ [- S; r
  27. #include <linux/errno.h>
    " n( `# @( A/ b
  28. #include <linux/types.h>
    " Z  c( C& g8 g# A
  29. #include <linux/interrupt.h>" O$ o, l* |  w5 w. f5 f) E, k+ Z
  30. #include <asm/io.h>% ?8 `& [# P7 N/ |
  31. #include <linux/moduleparam.h>
    : R# L; s1 v0 A6 ~) _7 `
  32. #include <linux/sysctl.h>( y; X) c; g6 C% \- l% P
  33. #include <linux/mm.h>
    0 e  \1 I6 |1 L% I! D' c+ p! D
  34. #include <linux/dma-mapping.h>
    - Z: |" ?# W" e  h% O

  35. 6 f9 u: V8 _5 ^- h2 X
  36. #include <mach/memory.h>, ]* T7 @) s# s: X& K% g' J3 D( ]: ^
  37. #include <mach/hardware.h>
    : F- B6 x& m/ {! U8 |  ^# E
  38. #include <mach/irqs.h>  \1 v+ J$ }0 U  `
  39. #include <asm/hardware/edma.h>
    + E: U+ P5 G+ U. e- z

  40. 2 M' D6 X) O: Y8 }; q) F3 \& l  \
  41. #undef EDMA3_DEBUG$ f% r9 s9 ?3 ~, a
  42. /*#define EDMA3_DEBUG*/  o+ U. F+ h# H* |1 g; y

  43. 9 V: m$ _' N: H
  44. #ifdef EDMA3_DEBUG
    + o' D; P% k0 d+ V! m0 ?7 }5 c7 {9 d; }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # ]7 D! B7 K& _' D9 b* B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). W* K0 m5 i: T- k4 ]* B! v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 g' v$ h( J+ K6 [8 t
  48. #else
    3 n6 k: F8 R$ h) f+ L
  49. #define DMA_PRINTK( x... )
    + g6 I( X" @7 r
  50. #define DMA_FN_IN
    / P$ b, H* R# Y
  51. #define DMA_FN_OUT
    , c, N: Z2 ?+ }# ~5 m1 U
  52. #endif
    5 }7 {. h5 x9 T, A  v, r/ ~
  53. . B; W0 X  s6 q" r/ W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' O- A" S9 U# }9 j! j
  55. #define STATIC_SHIFT                39 U" d! X# p6 ?7 M
  56. #define TCINTEN_SHIFT               20
    4 U- K. J1 Z- Q* u
  57. #define ITCINTEN_SHIFT              21
    5 e- u  s. T% m9 V& f1 J$ b
  58. #define TCCHEN_SHIFT                22
    8 O/ j1 _5 G, ^( X( F
  59. #define ITCCHEN_SHIFT               235 ?2 K4 E9 S* F# G( d  g( `* A
  60. 2 |0 L8 i: u+ T- e  I
  61. static volatile int irqraised1 = 0;
    ; S7 T; @; m; D7 K
  62. static volatile int irqraised2 = 0;
    " T1 k0 k7 z8 N% `) @- P' {4 K) `
  63. 5 `6 K( [- ]3 E1 A' L$ M" V7 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C  q7 m7 t6 F& L" }* E8 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a: D. R, P" C5 g* T7 O7 y' x+ I1 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \# _! X0 e% b% D8 ?
  67. : x. k8 f- a, I5 c; e0 p" ~
  68. dma_addr_t dmaphyssrc1 = 0;
    8 j4 p- T, F2 a; i' f
  69. dma_addr_t dmaphyssrc2 = 0;; d! {: a  C% e! ^) u* \' d  }
  70. dma_addr_t dmaphysdest1 = 0;( T% I+ C* T3 s. K7 Z' I
  71. dma_addr_t dmaphysdest2 = 0;
    ' g+ [9 C* R7 |2 f! y) h
  72. # q( Y6 D6 L) Z* Z0 M7 D. L4 Z2 F) m
  73. char *dmabufsrc1 = NULL;6 O5 _4 I9 @, _( M. {* h
  74. char *dmabufsrc2 = NULL;" s5 U* D- A% W3 j. I
  75. char *dmabufdest1 = NULL;
    - Q$ d& Y7 z, r
  76. char *dmabufdest2 = NULL;2 }5 Q# {' U4 Z6 Q5 D6 H+ u3 k

  77.   o4 z  q4 X0 {" u5 J3 a
  78. static int acnt = 512;
    - S; {4 \: a7 y4 o# I4 y4 U
  79. static int bcnt = 8;
    ; {; l8 X  z+ b1 f  ?
  80. static int ccnt = 8;8 F& z3 k, @- K+ i0 `

  81. 2 ~, P2 `3 X3 b# X, v5 W
  82. module_param(acnt, int, S_IRUGO);
    * R% [7 H$ q7 n* Q' d& X, w
  83. module_param(bcnt, int, S_IRUGO);9 N& D4 X6 G7 D2 Y: T$ W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 Z2 l4 m; H$ F  g( F

" _" K9 P3 U+ }! P' a5 s, N) o6 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 L% u! H- f8 n6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) U" r: q  d6 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  h: [) k3 |+ @" ~2 a

. C' A% d1 g2 j8 K" }6 _! p
# r$ Q) R  H3 m: W$ ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 00:24 , Processed in 0.040914 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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