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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% R8 ?1 f% ]/ K6 m0 Z
  1. [code]EDMA sample test application) R$ n  v, W7 k
  2. /*
    0 Y) J/ f4 t, S: {8 Z6 W+ C0 O
  3. * edma_test.c
      {/ q! a1 T6 N0 g: R" _
  4. *
    3 e7 n& N: W8 L* K
  5. * brief  EDMA3 Test Application
    ) g: M8 E8 C# Z- z5 v
  6. *
    ! \& |0 U7 }+ l; ?( \  u
  7. *   This file contains EDMA3 Test code.' i& H  x% @- b& N& }( L' d6 Y
  8. *
    5 e1 Y; z* c! f. E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ]7 F+ q. R9 O9 |: H8 m( X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" W# A& M( P$ D% Z6 l: J
  11. *         TO CHANGE.
    4 t; J  m9 U+ P6 }' Q8 E
  12. *
    " Z/ {% q2 V! g& P0 Z3 P, C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 X( f: [: h1 H7 U$ B
  14. *
    $ h' O; X1 `+ L* q# x6 E- h
  15. * This program is free software; you can redistribute it and/or
    9 b. Y! X8 X$ w. h1 Z  \
  16. * modify it under the terms of the GNU General Public License as' m# H  G% L0 A
  17. * published by the Free Software Foundation version 2.
    , n% f+ @; `0 I9 t  J6 {; Z
  18. *
    & M! w+ D9 J" n+ P9 N2 K  l% X/ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 @' S4 X1 t" W; n- u+ j4 `7 r
  20. * kind, whether express or implied; without even the implied warranty
    2 E) Y$ S% o, a9 N% l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 |  s$ u" R* D  z. L# {0 u/ V
  22. * GNU General Public License for more details.
    ( b% k- P  }; Q: T2 j2 f2 V
  23. */- i; A. T) V5 v' G8 e# p5 A

  24. 2 |- v: I! Q4 a! g
  25. #include <linux/module.h>+ R; V  V: G$ o3 T/ r8 q1 t8 p
  26. #include <linux/init.h>
    ( a# e6 z$ b/ {
  27. #include <linux/errno.h>
    ! `3 `" m4 O; W9 Q- x
  28. #include <linux/types.h>; F" P  P1 P2 R# y
  29. #include <linux/interrupt.h>
    4 m3 ^, v% l1 ?- _  y4 ~6 i
  30. #include <asm/io.h>
    + e& p" y& C& T4 v& E
  31. #include <linux/moduleparam.h>
    0 s5 T4 G( q# E6 B' w4 l
  32. #include <linux/sysctl.h>& \( \6 ~+ v1 H4 b" f
  33. #include <linux/mm.h>
    ( r) Q$ b+ X9 n7 u
  34. #include <linux/dma-mapping.h>: r( v. Z, j5 y$ U

  35. 0 \% W# V7 T+ Y# f( `+ ?3 t
  36. #include <mach/memory.h>
    ( z( {9 q+ K; f% M+ ?, r" Y+ J: h0 `
  37. #include <mach/hardware.h>: E, Z: N5 V! {$ d7 f
  38. #include <mach/irqs.h>
      a+ J/ I+ ]1 i+ l+ u6 S
  39. #include <asm/hardware/edma.h>
    - [1 |7 U( \# f' w
  40. ) \/ F" e4 C) y1 D# `) u0 e
  41. #undef EDMA3_DEBUG
    1 @0 s2 D* [/ m4 F: h
  42. /*#define EDMA3_DEBUG*/
    : T) N. i" ?) }1 @

  43. ; a5 _0 [0 L# c; |& Y* {
  44. #ifdef EDMA3_DEBUG
    * g& `3 H3 L( x! H7 F, t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 p) i5 M$ J& f. @" b+ @8 O, d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      L/ H9 i5 e' [3 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" }; K. b' w( f+ \* ~/ @1 |# z$ v0 Z3 p
  48. #else
    0 H' U6 s- c( K8 i5 Y
  49. #define DMA_PRINTK( x... )
      |+ P* \1 q7 s; |) o
  50. #define DMA_FN_IN; C9 b) E- j+ M
  51. #define DMA_FN_OUT8 k' k5 n+ z. m4 D! {1 F
  52. #endif; U' @' A# C* j3 l

  53. & B0 C: j# q" u! {' B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 J7 m0 T( r4 J4 X
  55. #define STATIC_SHIFT                3! Y. e7 ?5 ?& P  X
  56. #define TCINTEN_SHIFT               203 g( J) L( Z  n- @
  57. #define ITCINTEN_SHIFT              211 z& z4 e8 ]7 M  v/ ~  W
  58. #define TCCHEN_SHIFT                22* |6 x- N8 K5 b. x) F$ _
  59. #define ITCCHEN_SHIFT               234 A  o/ q2 T" @! }) ~6 t8 r

  60. 9 F. y. Z5 m, n4 u4 \
  61. static volatile int irqraised1 = 0;+ J, K8 y( }1 o. ^
  62. static volatile int irqraised2 = 0;
    ) ^& b# M/ i/ B* b: ^1 S
  63. 0 V' p9 x3 e7 x3 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _  I  Z5 g8 a' U  z) m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - F/ w5 L, [) |# M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ j3 x) ^4 [% W: ]
  67. , |/ }0 J$ P) V2 S5 g8 P
  68. dma_addr_t dmaphyssrc1 = 0;
    $ F, B" U2 E/ l+ D$ Q! N7 n- v, ^
  69. dma_addr_t dmaphyssrc2 = 0;3 H/ n# Z9 k% I) H( w. V
  70. dma_addr_t dmaphysdest1 = 0;! a+ H& \' p. @' t% L
  71. dma_addr_t dmaphysdest2 = 0;+ F) I% I- m" ~& _
  72. " e6 ], O4 t8 {
  73. char *dmabufsrc1 = NULL;- ]+ q* m1 z* m# X) {
  74. char *dmabufsrc2 = NULL;- A) H& ^, J9 l1 m% V9 L
  75. char *dmabufdest1 = NULL;6 J. K# n; j+ s1 {: E
  76. char *dmabufdest2 = NULL;+ ~+ d& [+ A: J) K/ O

  77. # D% g& h" L+ E1 H$ F
  78. static int acnt = 512;  ]# W; @, {; L/ V" |, b# ^
  79. static int bcnt = 8;
    ; B2 y5 `: |( j1 O; T4 G+ X' T0 @
  80. static int ccnt = 8;
    5 B' e% n; L7 {/ ^7 \' V
  81. 2 }; \& a2 T+ n- R/ R  Q( |4 d
  82. module_param(acnt, int, S_IRUGO);. o- \! c# t6 c2 H
  83. module_param(bcnt, int, S_IRUGO);% ]5 b: h8 X. O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 m5 g* j5 I7 Y  i% q9 z8 k

; d" R( U' s3 I! L/ o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ J7 ?' `2 s( E5 u4 n+ W9 \- Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) M" i% {  G/ d8 d, D  {& W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: q9 z( J( ]( v  J) G" O
$ s/ L; ^, x; G: y. m! d" ~
7 l$ _' c3 F( Y9 u8 |5 e3 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-21 05:23 , Processed in 0.041318 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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