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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  c# F, X: e# h" U' L
  1. [code]EDMA sample test application  o: d$ Y8 P& u4 r% Y8 e
  2. /*& N. y( |# H7 k. U4 a; I
  3. * edma_test.c
    0 g+ Q( r+ z- ?2 N* R9 _
  4. */ ]( @0 K& W5 Y* ~
  5. * brief  EDMA3 Test Application
    $ W/ H' p. g; o# q8 p
  6. *
    6 p2 \# M0 t5 A1 f: B9 K
  7. *   This file contains EDMA3 Test code.
    ! L3 _6 X. g4 M9 j4 F1 b
  8. *
    # ?0 G/ X- N4 h7 h7 I2 G" s/ y- T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! J0 F: i  ?( x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( F+ Y: T# S) E
  11. *         TO CHANGE.
    $ S9 Z6 L  J+ F8 M" q
  12. *% U# p7 M9 v3 R8 c8 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 m! q+ j  w) F' w4 {$ Q
  14. *
    ! A: v* i, D# w6 T4 q: X4 E- ?
  15. * This program is free software; you can redistribute it and/or7 T4 @" H* s# A: ~- u+ v
  16. * modify it under the terms of the GNU General Public License as
    + b3 D' @3 d$ s
  17. * published by the Free Software Foundation version 2.# D9 `4 c. f( H8 ^5 h. w" J, V6 U
  18. *
    $ h. p) k. H/ e$ t' X- Q$ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / C& x6 C/ f# h, n8 ~
  20. * kind, whether express or implied; without even the implied warranty$ e% j4 I) T: e* F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( h6 u3 o# P' n$ {9 a) h& F3 E- ^
  22. * GNU General Public License for more details.0 a$ Q7 O1 k+ [! ?; \
  23. */
    9 C5 A" [& ]7 Q* |1 b% W! Z
  24. & N  Q3 p/ y$ f
  25. #include <linux/module.h>
    - c6 @) ]2 d& `. q/ ^
  26. #include <linux/init.h>$ b2 i5 @9 Z4 S$ j9 f( J5 B
  27. #include <linux/errno.h>( ^7 G( t7 ~0 v: U
  28. #include <linux/types.h>) L! Y4 d' w! o, V1 I; y
  29. #include <linux/interrupt.h>
    + w# t* m; ~4 Q: P! X* v
  30. #include <asm/io.h>
    ' W5 S- |# M- e# O- d2 h* y
  31. #include <linux/moduleparam.h>/ O6 j: H4 \. c+ `6 g4 p
  32. #include <linux/sysctl.h>$ S9 z# G) L4 s% Q" t
  33. #include <linux/mm.h>+ x3 M1 f1 ^% w* b- S, |! X
  34. #include <linux/dma-mapping.h>, d/ `( }2 o/ W# Z1 U4 e

  35. / b3 O. s& @" p( @4 X. b
  36. #include <mach/memory.h>
    2 k  p  p0 F; v
  37. #include <mach/hardware.h>9 J+ X* N! e7 z; W4 [3 X
  38. #include <mach/irqs.h>$ {( u; j4 Y, p1 N# f; Y
  39. #include <asm/hardware/edma.h>
    0 a+ C% @; ]: [+ u  Y, H& E

  40. % I, T0 _- V  \9 k4 D( i
  41. #undef EDMA3_DEBUG
    ! j! {, \6 t8 R0 I7 N, ^2 n4 C
  42. /*#define EDMA3_DEBUG*/, ?, \. e6 l0 U, f. A- M
  43. 1 Y+ x0 K5 y  s6 L, o0 v0 t% z
  44. #ifdef EDMA3_DEBUG6 a9 b( a0 E0 _( |0 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" h3 l! N* d: o. I7 Z5 c5 }0 s3 A5 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / `* f. p/ B1 X. w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & R! L  l2 }6 ]2 i! x- [
  48. #else
    4 Y  c  V: W6 i9 _7 u' e6 H
  49. #define DMA_PRINTK( x... )
    : i! y1 p1 f. w/ K. U% `
  50. #define DMA_FN_IN
    2 B! i0 ?' p+ g1 y- u$ G4 O
  51. #define DMA_FN_OUT. |5 S4 H6 W  j
  52. #endif
    + \2 I- N! k4 ~, j/ ^$ i
  53. ) x- x1 C. A3 n+ C' J; ]/ z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 p: r) }# ?0 O0 ^8 j/ R2 W
  55. #define STATIC_SHIFT                3
    * @% U. i2 V( ^  Q* r3 [( h& }
  56. #define TCINTEN_SHIFT               201 g0 e% z7 O: ]; u
  57. #define ITCINTEN_SHIFT              21; N8 ~. l2 y; s5 W3 `: ~
  58. #define TCCHEN_SHIFT                22
      ?( r2 B6 x3 A
  59. #define ITCCHEN_SHIFT               23
    0 w  b1 Y( i" F7 ?7 h2 ]( b+ b
  60. 7 ?4 L5 H8 F5 [5 ~" E
  61. static volatile int irqraised1 = 0;& k+ Q8 K& Y' F' ]8 W! }  G" R
  62. static volatile int irqraised2 = 0;
    ' z& Z3 Y. z9 n/ M5 W. P8 t

  63. ' E2 M3 Y6 S; a% M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ?9 D( E+ O3 ?( ]2 B( e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 d( T6 _  p1 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& u& T3 N3 C* `5 T2 A. j$ _

  67. * S( n; g2 v, ~( z, I; H* l1 O
  68. dma_addr_t dmaphyssrc1 = 0;
    5 s# K# W3 m1 y0 {
  69. dma_addr_t dmaphyssrc2 = 0;; @9 g" C' @' l' \9 p: [
  70. dma_addr_t dmaphysdest1 = 0;% [$ l3 U5 S  |5 ^7 _% j, o( `
  71. dma_addr_t dmaphysdest2 = 0;
    8 P: K; C/ L, x4 B

  72. 8 \0 {7 i; n' v: I7 f
  73. char *dmabufsrc1 = NULL;
    * |0 z1 Y5 T! m, w5 @5 Q! i
  74. char *dmabufsrc2 = NULL;
    2 ~$ [9 ~) n6 b* p9 i* n# A2 h& m
  75. char *dmabufdest1 = NULL;4 H4 w. o( N  |0 Q5 j
  76. char *dmabufdest2 = NULL;
    , T  o& `0 b  d
  77. ) \$ @0 ?  f+ w. ?/ P) l$ B2 J
  78. static int acnt = 512;/ U' P- Z) c3 y" h+ ^8 D1 ]0 w
  79. static int bcnt = 8;
    : i; g1 V" c1 @$ z2 L7 e4 ?
  80. static int ccnt = 8;0 V; V8 c9 r8 j! X' Z( K& A; c- v
  81. + {# t* i7 Y3 G+ S1 C
  82. module_param(acnt, int, S_IRUGO);: M/ o5 i" j9 N2 G9 n3 l2 B/ P  g# S
  83. module_param(bcnt, int, S_IRUGO);- P; `' I* N+ }( B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* S. W. ]0 d- t

. _+ `+ q, E+ b4 l! n* I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ s$ K2 O/ m/ I( b' Y- ^5 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 R3 d7 f; @; g# q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! o! c& h/ A) `$ n- L

/ d5 D. ]2 d3 s1 B3 @' |! j# D* `. V3 x" ?- Y+ o/ N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 08:26 , Processed in 0.041062 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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