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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 ~, J* w$ \" @
  1. [code]EDMA sample test application
    . n' K4 {# G- w0 P
  2. /*- X. b+ e; F7 {6 {* C4 R
  3. * edma_test.c
    / Q& R2 O0 b. x# i6 Z: f
  4. *
    6 ?! o, I7 X$ [
  5. * brief  EDMA3 Test Application
    9 y+ M; C1 j7 A' m
  6. *6 W/ m" i. Q& k, S8 o) _
  7. *   This file contains EDMA3 Test code.  r3 R( N/ L% ^: g0 ~1 l3 W2 e* s" E
  8. *# P' x" {. P" Y: f. D* x9 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 P- p1 g) y+ k! D2 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 S4 R+ H+ S9 }
  11. *         TO CHANGE." V% ~. e& i* Z! }0 y- i& T
  12. *! \. ^# U* }  ^+ j8 `! t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; }. Q9 X9 U# t( o& ^6 Y+ |
  14. *: ~2 s, \7 I/ x# u
  15. * This program is free software; you can redistribute it and/or; h' i* {$ W  M  Z. r/ ]
  16. * modify it under the terms of the GNU General Public License as
    . p! u7 o7 r: l# {
  17. * published by the Free Software Foundation version 2.4 r7 Y8 j: p" N; p& z
  18. *
    7 u0 ~0 |/ D" i1 r, T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 r. I7 q; [- G1 P, B) i: h
  20. * kind, whether express or implied; without even the implied warranty" h  N, G: n2 N% u; z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 |" |* [% _8 o- [
  22. * GNU General Public License for more details.; X' P1 V/ u; P/ r' J  R% @8 x
  23. */
    7 @3 b+ |; r; i$ w/ ^' a5 C' P* [
  24. / i7 ^0 ~+ o' B4 F! |* v1 q
  25. #include <linux/module.h>2 }9 K% I* P) {
  26. #include <linux/init.h>$ M4 f/ f$ u" X5 C) V% w
  27. #include <linux/errno.h>
    4 z3 A0 [7 i' t4 L' m  \
  28. #include <linux/types.h>/ Z+ D/ |& w" b# j4 k3 Y  P
  29. #include <linux/interrupt.h>
    # D- a# p6 H# H
  30. #include <asm/io.h>
    7 M  p  L7 [  Q7 N  q# W
  31. #include <linux/moduleparam.h>
    ! b# l: b2 f# Q$ Y* y
  32. #include <linux/sysctl.h>* l2 N2 B7 {! t5 G% I; L
  33. #include <linux/mm.h>! i' S, I% x- @) |# m2 O. V
  34. #include <linux/dma-mapping.h>
    - H: {& W: m1 s* @4 `4 P) E
  35. 9 p/ G2 o$ i  g2 e
  36. #include <mach/memory.h>
    % Q/ F( [) y+ R( _7 s, I7 Q
  37. #include <mach/hardware.h>2 w6 L0 B9 e. X; I; l" h
  38. #include <mach/irqs.h>
    ( I6 A8 T, \% p* Z4 s
  39. #include <asm/hardware/edma.h>4 u+ w1 `* d* ?9 l) Z# }

  40. : b7 J9 H8 q2 U- k$ s! J* G+ {8 [
  41. #undef EDMA3_DEBUG+ k0 I4 ?0 {9 N  }
  42. /*#define EDMA3_DEBUG*/; @+ |, Y: y! G. r+ A
  43. 6 u8 G6 c6 u7 K5 L& W6 g, _
  44. #ifdef EDMA3_DEBUG% z9 z7 `1 H4 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + ^6 R- O: ]6 X/ E  p& i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 k7 s4 {1 i2 K9 T( ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : L- d. X2 g7 c6 M5 ^- K
  48. #else
    " g/ T/ l( R* R+ }1 \
  49. #define DMA_PRINTK( x... )0 D2 Q5 F3 }& w9 c
  50. #define DMA_FN_IN
    " j- `6 n6 W' F$ }) k9 w9 `" N
  51. #define DMA_FN_OUT* r! C/ ^+ Y8 t3 G: u3 l
  52. #endif' E7 i' e  b; F0 u# r. ]

  53. % E; `" R5 r$ T8 L% o$ I9 m  }) b9 }7 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " |) h0 N1 N( i
  55. #define STATIC_SHIFT                3
    * q& ^9 q0 j& j
  56. #define TCINTEN_SHIFT               20
    # p& @+ T) ?: J1 J
  57. #define ITCINTEN_SHIFT              21
    1 n+ R% Z9 l& O* N; ]+ G, o7 e/ @
  58. #define TCCHEN_SHIFT                22
    . K  R! j  V8 u7 w  _, B% U
  59. #define ITCCHEN_SHIFT               23
    $ S9 O8 Q- h; N+ t3 `- _
  60. / ^8 E% K6 w  D7 L0 |
  61. static volatile int irqraised1 = 0;! l& {7 n& E) Z* \9 p: o' v1 \
  62. static volatile int irqraised2 = 0;
    ; K/ Y5 p  i; V7 }; P
  63. & i, g0 K; T% a2 w* Z2 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % d- E( `1 a. e( v( Q, y7 v- c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Y) T5 K8 a! Y* F" o) r) L7 r9 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) e  z+ _( g6 a
  67. ! L1 g9 Q- ~. E) W7 O
  68. dma_addr_t dmaphyssrc1 = 0;
    , C2 q$ L& f6 j; N
  69. dma_addr_t dmaphyssrc2 = 0;
    * r) p3 v  @0 C/ ^
  70. dma_addr_t dmaphysdest1 = 0;
    6 s3 t" \3 ~6 h9 K
  71. dma_addr_t dmaphysdest2 = 0;+ i- ~" K: u# Z3 M& r
  72. # ?9 O  M' y6 A$ d3 x% b
  73. char *dmabufsrc1 = NULL;9 h6 W4 E  h" k. R8 Q8 t) ^
  74. char *dmabufsrc2 = NULL;
    + P( H' P# K6 f. M& v
  75. char *dmabufdest1 = NULL;
    ( Y0 k/ g0 B/ T
  76. char *dmabufdest2 = NULL;
    # v( c- J; O* q1 I' U8 P, L% O
  77. , K) U% p  k6 @
  78. static int acnt = 512;& N1 d2 T6 a! u" t, x4 W) F0 @5 n  e
  79. static int bcnt = 8;# Q1 d4 i" n; \  p  s7 {
  80. static int ccnt = 8;
    & h: O. |( F  i4 G

  81. 0 X% E5 K; @( N( b
  82. module_param(acnt, int, S_IRUGO);! q' K2 i: P2 ~; M0 H- x$ \; g
  83. module_param(bcnt, int, S_IRUGO);7 `. H7 `5 @( V. v8 g8 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' R7 n3 h+ s- H. S$ z

& ?% u& e& a1 g: b$ w% o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 P0 ]7 ^5 W4 h2 y5 I. C: h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- N" P/ F+ x0 h* Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  X' G9 B( t: d7 @2 c5 ~8 j1 k. n2 J  w3 m. @

" D; i: s- m8 d, [) g+ `, f7 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 20:24 , Processed in 0.039331 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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