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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ R( Y# |: M6 o" j  b
  1. [code]EDMA sample test application
    ' Z4 k! S5 ?! U
  2. /*4 L7 `  H8 i: f* v- ]$ m5 |, M. w
  3. * edma_test.c! h0 }" ^! j! I/ g" k9 r0 B- e8 X' H
  4. *( Z7 B' v' V7 @" {- E# x. W
  5. * brief  EDMA3 Test Application- J" R. |" [7 ]* k8 _
  6. *
    " v  |! v8 C# D8 T+ ^8 U
  7. *   This file contains EDMA3 Test code.
    ! _1 ?% ^5 \% D2 q' \. b/ m3 S
  8. *" N2 n! Z9 G5 u7 V4 G5 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - R7 Y( R( q6 k  k! j& r  B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / U* {, T2 z: V% u
  11. *         TO CHANGE.+ R+ ?; b7 t. Y& A* J1 d
  12. *9 ?# B; ^; E# _& V/ z9 F# \1 k& |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( h4 o3 l. i7 q6 {: i' M
  14. *8 X) G' I+ W# _/ L; j8 @0 ?9 w' c9 D
  15. * This program is free software; you can redistribute it and/or, D( {3 F: W" p% k/ w4 W3 l% k
  16. * modify it under the terms of the GNU General Public License as
    2 U3 R6 j9 F+ x, H: j7 L$ p( h+ d7 x6 y
  17. * published by the Free Software Foundation version 2.
    1 F' B) P& M& b6 m) g/ M
  18. *
    4 J% b% W/ a+ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / ^0 A0 W1 E: [* o: y* N
  20. * kind, whether express or implied; without even the implied warranty
    & {( c9 c7 k/ f5 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      f* P* w- `3 ^/ Y9 l# H9 o
  22. * GNU General Public License for more details.
    1 b0 U) W0 h" z: p
  23. */
    / j% p* L& p+ T: U! b( |' _

  24. $ i5 i( u! l# K% ?3 a
  25. #include <linux/module.h>7 |2 o6 q* |5 u8 @  v1 S9 p. u( T! h
  26. #include <linux/init.h>
    - S. \- _' U- i: F, f" F# h5 T
  27. #include <linux/errno.h>
    " ]% r" O1 z6 o% B) N8 w
  28. #include <linux/types.h># Q2 U- H% B% G* h. Q
  29. #include <linux/interrupt.h>
    # ?( s9 E: ?# ^. e8 x
  30. #include <asm/io.h>
    1 ?; z7 {( m) _
  31. #include <linux/moduleparam.h>
    ! }% z* u+ v# V; M2 X7 {
  32. #include <linux/sysctl.h>
    / F0 j) f2 {% \: f( @/ C  P- b
  33. #include <linux/mm.h>
    : ?) v$ z' M" w
  34. #include <linux/dma-mapping.h>3 o; n9 c# p1 u* P* {+ N. D/ e
  35. 7 H* ^  Z3 t# ?
  36. #include <mach/memory.h>
    * q  l5 H+ _# l* I5 Q9 F8 L
  37. #include <mach/hardware.h>+ x3 P. ^# u0 ?! D) J
  38. #include <mach/irqs.h>
    8 y6 l: B; v' i$ b7 H  k+ R5 _& E
  39. #include <asm/hardware/edma.h>
    ' m3 w$ Z. L+ ?* k* w& W+ b
  40. 2 h0 S7 A7 C- Z9 C
  41. #undef EDMA3_DEBUG) W& [, b9 D( g5 `" n0 x  Z
  42. /*#define EDMA3_DEBUG*/
    % ~! G! z' {: h: E! Q

  43. 9 u+ v$ C9 G0 L6 D4 h$ D  D, f& Y
  44. #ifdef EDMA3_DEBUG+ |* v+ m5 M5 ]1 s6 o/ f3 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 t) K9 y' f, L' a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 u% L3 V7 W/ M% H. Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) i$ u: X/ b+ _) u4 ?1 @/ ?6 z
  48. #else- V: k5 i; Z! }0 e8 o; N7 b6 ^
  49. #define DMA_PRINTK( x... )* W1 \$ g! e0 l0 X
  50. #define DMA_FN_IN9 w: k; v& e# K5 o+ N8 B2 R
  51. #define DMA_FN_OUT3 c$ ^. i9 D) n) }" Q6 U
  52. #endif" F9 |: C- ?4 [4 e( i+ x

  53. ' j1 _, F) b& B2 o( n! `3 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), j6 V0 g! d7 R) \* h
  55. #define STATIC_SHIFT                3% J8 `) s4 C+ H6 L
  56. #define TCINTEN_SHIFT               20: B, ~& k) g7 U
  57. #define ITCINTEN_SHIFT              21; y0 M! P0 ]. \" e/ W
  58. #define TCCHEN_SHIFT                221 l2 L) Q3 `: U* H$ X6 B% u
  59. #define ITCCHEN_SHIFT               239 ]3 c4 e  _- b9 i7 P# V# L

  60. ' G4 M. j0 V6 \; I6 Y$ F
  61. static volatile int irqraised1 = 0;4 o: o, [+ w  M  M+ \6 j
  62. static volatile int irqraised2 = 0;, G( Q8 }% e+ u
  63. % e: L- l2 {% ~/ g( \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Z# K. i; M8 n9 i% p  Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# S9 Q$ V; ]7 q4 E, z: f" b. ]: a0 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ]" Q& Q! o2 \& }1 \6 l/ {
  67. % b( u) @. E* G) T0 z" S
  68. dma_addr_t dmaphyssrc1 = 0;% @+ h) N, K  q# Q) X( L5 Y* L
  69. dma_addr_t dmaphyssrc2 = 0;
    - s! h) ]0 m( e) G8 J3 \' V0 f
  70. dma_addr_t dmaphysdest1 = 0;0 q8 [6 _1 V5 q2 Q% y
  71. dma_addr_t dmaphysdest2 = 0;
    / ], w: [! R5 g: [
  72. * X" q4 w1 ~# a  Z, F1 A. ]
  73. char *dmabufsrc1 = NULL;
    7 h3 m, q4 H: A2 d. u1 V
  74. char *dmabufsrc2 = NULL;" u, g+ i' ]9 k3 X1 ]/ o% Y
  75. char *dmabufdest1 = NULL;
    2 o) I% j$ ^: E* C( _
  76. char *dmabufdest2 = NULL;2 t% r- x8 p0 j9 J9 z: |
  77. , G8 E3 |% L- ]5 m
  78. static int acnt = 512;% K. J! R/ L6 |2 {
  79. static int bcnt = 8;# H) s# K1 s; X$ {
  80. static int ccnt = 8;0 c" t' v+ E' `2 a( m0 n6 U/ R0 B

  81. 9 J5 U% }- I: ~4 Q) J( d: g
  82. module_param(acnt, int, S_IRUGO);5 M1 C7 s' v+ J9 h
  83. module_param(bcnt, int, S_IRUGO);% |) A. ^# h9 ?4 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 b$ E; ^4 M  L) E

0 {; r' i/ u" F: r. [4 m1 L* U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* h; s' F4 o: p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, S, g6 R/ T* D: ~4 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; x( S! R& H) ?) |4 L" ^
. ~( l8 c" R# ]# T5 h$ B/ |- M# d
! t% s2 L! ?) }4 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-2 08:15 , Processed in 0.044288 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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