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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, J& `' d1 p+ z
  1. [code]EDMA sample test application
    . g3 }5 p  t6 A2 h. v' u
  2. /*+ Q) u  J+ g, j) J2 d* `! a
  3. * edma_test.c
    ( E$ r6 U. C; ^! j: r- q
  4. *
    , v9 ]4 o; h) ~4 Z8 p
  5. * brief  EDMA3 Test Application
    $ k% |( Q7 f; P: ^$ {/ T7 w
  6. *1 U& G5 J2 ^3 t7 w  F6 o' Y8 q
  7. *   This file contains EDMA3 Test code.  c* [8 `8 O) l% }9 _; Q9 U
  8. *
    9 w* F! r2 x% a9 b* w( Z; {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" p5 v2 ?6 R5 h6 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Q! o; R6 F* C# d- c
  11. *         TO CHANGE.
    7 v: Q8 @# V- x8 R3 N! x6 E( r
  12. *# E8 e, @1 T2 c, R2 |7 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 C6 v9 ^5 u( L& K
  14. *
    1 i5 k; Z& {6 }) _
  15. * This program is free software; you can redistribute it and/or4 _0 b- f. J4 E0 m& P
  16. * modify it under the terms of the GNU General Public License as; i/ b2 p! o; r0 g! `
  17. * published by the Free Software Foundation version 2.4 e  t- {' w7 g% G0 I; ^0 `
  18. *
    & v: C' W: R* M6 I% J5 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; m7 s! q( Z* i
  20. * kind, whether express or implied; without even the implied warranty) Q8 M$ N9 L& c  O5 J& u$ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* s  W& M3 X- J2 ~8 U, b- ~# b3 S
  22. * GNU General Public License for more details.
    0 I; Z# S# u$ [. T8 i/ O; e
  23. */
    . {. k$ k( a5 q" ~1 ^8 E
  24. 1 Y& l6 s' |  M* k( a$ _
  25. #include <linux/module.h>, p0 z: m! a) E& S
  26. #include <linux/init.h>; R, Z4 s( a& Q
  27. #include <linux/errno.h>
    % s  O, }4 |6 W- G) V
  28. #include <linux/types.h>
    ) y* e5 d) ^& P2 u
  29. #include <linux/interrupt.h>6 V% Z8 G. [2 m5 d
  30. #include <asm/io.h>
    % j; B0 |; |9 F% i& C0 G  f
  31. #include <linux/moduleparam.h>
    9 v' S5 N0 K% J# K
  32. #include <linux/sysctl.h>
    ! n  U# s( T! ?8 m0 f/ a& M& z3 E" k
  33. #include <linux/mm.h>- C9 H3 m" F0 B% M
  34. #include <linux/dma-mapping.h>
    . X4 [+ `) N. p9 {5 O& x1 C

  35. ' q. O+ w# G. G; c7 K& M/ y
  36. #include <mach/memory.h>2 W$ h# R( A% O& `5 h
  37. #include <mach/hardware.h>
    8 x# ~5 ^5 h0 [6 z
  38. #include <mach/irqs.h>6 l  x' t) m2 P  i$ T4 s
  39. #include <asm/hardware/edma.h>
    - K$ d' Q7 e1 J3 a5 X; v+ Y; Q

  40. : ?# @2 G! P. ]0 h
  41. #undef EDMA3_DEBUG
    , I  [9 k: G" L! E4 e
  42. /*#define EDMA3_DEBUG*/5 u9 r4 Q+ B4 z) D$ m% ]) w
  43. 1 v& j, ?6 W/ O7 y- \  S6 \
  44. #ifdef EDMA3_DEBUG
    0 x8 r( U# N' Z' |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): w- u8 j) Q( u# l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 s5 e) S$ n; v$ T, X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * M) N1 B" `" U' _' d6 O; r# V
  48. #else
    / K& c0 o( J, e1 E' U4 _" O/ e
  49. #define DMA_PRINTK( x... )$ e2 l+ c# g8 f# l
  50. #define DMA_FN_IN
    5 U# h5 @0 n  C+ i
  51. #define DMA_FN_OUT1 n- H4 k+ d/ P: I' e1 C- c9 @4 S8 ]  Y
  52. #endif7 O9 Q" J  I1 E0 I
  53. 8 A# t6 `2 V; U4 g6 ]( W* c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 e- N' m( c/ E- l
  55. #define STATIC_SHIFT                3
    " x3 K0 X7 o8 W( ~$ j
  56. #define TCINTEN_SHIFT               20$ _4 R$ p' O' K
  57. #define ITCINTEN_SHIFT              21/ X' ^5 d- ~7 J
  58. #define TCCHEN_SHIFT                221 n8 F  a, u, R% J; R/ I- _5 s
  59. #define ITCCHEN_SHIFT               231 h2 V, t9 Z% [

  60. + E6 \( L7 F% i
  61. static volatile int irqraised1 = 0;( Z/ ]9 e/ Z( [* a8 ]
  62. static volatile int irqraised2 = 0;
      Y0 I, ?$ s3 ?6 |* ?

  63. 6 b) ^" Y) z1 D3 ^$ @& y; T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 x) f, V8 A" P& O/ D& ~! v, J6 k3 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }) N& a8 Z! T2 |( x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H/ {+ o/ `: s* W* Q1 i, F+ T% q

  67. : R' H* G. S7 M3 a) S
  68. dma_addr_t dmaphyssrc1 = 0;) Z- o1 T" b0 I- Q" S( m# M( e9 @
  69. dma_addr_t dmaphyssrc2 = 0;" L" I" [% o: R& a. ^  P. i$ g' {
  70. dma_addr_t dmaphysdest1 = 0;
    : Z( Z! y# H/ }
  71. dma_addr_t dmaphysdest2 = 0;; L  D4 t3 K- }& ~- u+ d6 x

  72. $ Z+ m+ ~, n$ ?1 Z8 S
  73. char *dmabufsrc1 = NULL;
    : E; L4 c+ q+ \( L& g: u- f% z
  74. char *dmabufsrc2 = NULL;+ A- Y( `6 y; T; V+ ~: J  F" d! x; B% c
  75. char *dmabufdest1 = NULL;0 G, s) ~: F7 X$ D" @
  76. char *dmabufdest2 = NULL;
    ' \  Q) A2 u6 j3 G( @0 R
  77. ; O: b0 [  G! T& k: u, K
  78. static int acnt = 512;
    . [% \5 d  h  w, a7 c( ]9 [
  79. static int bcnt = 8;
    + t+ I) U* \/ E$ N: s4 Q+ V
  80. static int ccnt = 8;
    ' K8 ?9 U# V, ]/ j
  81. ( p& l& G0 p8 w, i' f" s6 I( X
  82. module_param(acnt, int, S_IRUGO);! z* \; q3 z$ e7 H5 ]: Q: {# |* q
  83. module_param(bcnt, int, S_IRUGO);
    : Y5 }& G& r+ f+ z5 i( ]- U5 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& c. s( D7 r4 L1 j4 q+ i2 w: g

; w6 R8 b0 P6 I* W7 e6 k; S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) i# P0 ?1 ?9 G, ^, g) W2 g# Q- U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, t8 o$ n$ U1 W! M' R( l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 {  s5 p: R/ c! c" s

8 s4 v0 R1 [! t* I  q9 _. g3 A
1 f0 b- g, N; G8 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 04:44 , Processed in 0.039099 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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