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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : L$ V1 k* |# E$ G
  1. [code]EDMA sample test application
    / b. U+ ^2 W( [3 o2 F
  2. /*
    : `% }+ R( N1 M! }
  3. * edma_test.c6 i9 I; i" ]& A3 \7 T$ b
  4. *! v* L, ?3 T; j# s0 T
  5. * brief  EDMA3 Test Application! M7 z) D9 C- c+ w: I
  6. *3 @8 Y. }! @7 Y5 J! M7 `0 E# V
  7. *   This file contains EDMA3 Test code.
    % h0 [' J# y* c+ o. K0 q
  8. *) v; {8 M( ^3 W( D. ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. i5 z' G% }9 n( Y& v4 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! N- b2 e& V$ h- H( E6 }
  11. *         TO CHANGE.
    0 [1 {( W# h4 ?  T0 f; ^& q- W
  12. ** w2 P/ q( a) M0 N" Y$ g. z2 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" q* F' @$ i$ {" J+ D( L* a  r) o5 ?( ^
  14. *4 g. [" |2 g9 v  Q
  15. * This program is free software; you can redistribute it and/or
    & t1 ^; n1 e" n: S% P# y
  16. * modify it under the terms of the GNU General Public License as& C  v  z; f0 K& u: {
  17. * published by the Free Software Foundation version 2.
    ! g( I6 ]/ ~) i$ \5 M
  18. *
    1 s% B0 W) ^& P2 E. M3 M# \8 N' p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 C, R1 X; J+ J3 e+ \+ Y" J
  20. * kind, whether express or implied; without even the implied warranty) _4 S' }* a0 S* ^* A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) h$ w" Y5 O9 ?7 f: S# ^
  22. * GNU General Public License for more details.2 }1 K. B% a4 e( G
  23. */
    8 i8 W! `7 y( Y3 G$ ]6 F7 c
  24. " ]- t- l# @, K- c, V$ e4 S
  25. #include <linux/module.h>
    2 k9 n! c! I+ o3 ^
  26. #include <linux/init.h>
    6 N! x7 z' i6 ]
  27. #include <linux/errno.h>5 I+ }  s3 d, |/ t7 J+ P  e! [
  28. #include <linux/types.h>) S& h- x) X! A2 j
  29. #include <linux/interrupt.h>
    0 U. k! k4 V: o% }: ?% j
  30. #include <asm/io.h>' `# H4 ]! d( u
  31. #include <linux/moduleparam.h>
    8 i) ^& p; O$ ?2 |
  32. #include <linux/sysctl.h>
    3 p, z$ Y/ g7 Z0 B9 Q
  33. #include <linux/mm.h>+ ?: F: N3 J3 @* a3 \
  34. #include <linux/dma-mapping.h>- E( P/ C% R! G7 U- g' }; f5 `; Z
  35. 2 D  T* a3 a. L  L' ^
  36. #include <mach/memory.h># i" i3 I% Q* M, ]# _  Q& ?5 ]
  37. #include <mach/hardware.h>7 d- ^0 R8 _8 H- A5 y8 }0 t
  38. #include <mach/irqs.h>' z( s7 t) i( W) A
  39. #include <asm/hardware/edma.h>  @) M% R* B6 N. G/ `5 A; b

  40. - _8 y: C  T/ t- }
  41. #undef EDMA3_DEBUG8 ~9 v( Q2 n- y, S' u0 ^
  42. /*#define EDMA3_DEBUG*/0 o6 ]. m9 s: S) q0 C6 c$ ]3 f

  43. 6 d8 a( Q: l  A* g/ T' U  H
  44. #ifdef EDMA3_DEBUG
    * J& M% ]' h/ R2 s' F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 g! N. u% M9 q, }+ Z" K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! F& O- j6 S  \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), t: p% v1 J5 X; M
  48. #else( V2 L6 J9 U( E; l0 g: W2 [
  49. #define DMA_PRINTK( x... )
    ) z8 }' w3 P9 n) U( @& M
  50. #define DMA_FN_IN3 v0 l; M7 I: D" z- L' @! G' B
  51. #define DMA_FN_OUT
    ) B' A* C! t! I2 t
  52. #endif8 p) F$ n, ~3 P4 s. j) }' I
  53. : y& H; e% H$ S1 c. F3 E$ E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 O( m8 |: I' D: W: U( n" \
  55. #define STATIC_SHIFT                3
    ' E% Q  b% o$ ]' ~3 Q
  56. #define TCINTEN_SHIFT               20; U1 U# ?# K$ n0 `
  57. #define ITCINTEN_SHIFT              211 J, E9 p0 Z, Z. \2 H$ `# i0 M" X
  58. #define TCCHEN_SHIFT                22( E$ T* L, Q8 F1 [
  59. #define ITCCHEN_SHIFT               23: g/ V; i9 T) L3 u2 f

  60. ; @/ ]$ a7 P# [+ N- l1 f
  61. static volatile int irqraised1 = 0;5 [) o2 ]3 g; V6 H; A/ k( q& \
  62. static volatile int irqraised2 = 0;. S6 B; }8 ^% H# B  `' |
  63. ' o# u  ^. h9 x6 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 o" ^! u6 q6 K2 _8 g( W" P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 D$ \4 n9 q' t- j7 Z: X7 `9 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; I5 {& o8 [4 h

  67. ( k. `4 O2 A6 C
  68. dma_addr_t dmaphyssrc1 = 0;
    " N$ Y* V5 q9 p' o$ A
  69. dma_addr_t dmaphyssrc2 = 0;
    3 }2 j: ~" p1 H8 w: X
  70. dma_addr_t dmaphysdest1 = 0;% ^# W$ h' d3 D& y& @& n
  71. dma_addr_t dmaphysdest2 = 0;
    + A! c' E0 M* s5 q  D0 X+ y) L

  72. - [0 p- o- l* c+ v
  73. char *dmabufsrc1 = NULL;$ e- G; J$ q$ ^' f. v5 Q
  74. char *dmabufsrc2 = NULL;. I3 C" h$ x4 n4 ]/ g
  75. char *dmabufdest1 = NULL;
    1 G8 ]5 c! `2 i; D3 Y; B
  76. char *dmabufdest2 = NULL;
    0 [$ }+ H; x" _+ z1 R6 s" s

  77. 6 a* X& a% w9 y- K9 j0 d0 W# }* j. ~. l/ G
  78. static int acnt = 512;. w- P4 r2 O+ |: p2 ?- ]+ ?& ?. x
  79. static int bcnt = 8;4 t/ N3 u- [( z  a+ S7 {  o
  80. static int ccnt = 8;
    4 q" x- C2 }7 }/ ?* r
  81. $ P  f! Y' P; r1 n! n. S/ z
  82. module_param(acnt, int, S_IRUGO);
    + B% ~8 u& Y3 B0 V) w8 V! `
  83. module_param(bcnt, int, S_IRUGO);
    ; Q6 J/ V! R3 I% t2 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) x  g) x) d4 X/ F# j" X
+ L& z2 h2 l' r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& B% |: Q% ], ?+ `4 K. earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; D2 E( f* A7 S6 p3 T$ ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ _& L$ \/ Z' n* N; l

; [8 g. z6 l  S$ l7 j$ i6 A8 n
0 X& ]% v/ F2 Y2 j3 W" C- K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 04:07 , Processed in 0.048520 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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