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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: z( `: V! B" Y3 N5 o+ t/ ]
  1. [code]EDMA sample test application
    1 s4 F/ K( W3 |5 D3 Z' l
  2. /*
    9 j* Q1 Q+ R. B$ u7 n5 Q' I! m6 k
  3. * edma_test.c
    # J  S# v9 V! B6 Z- {$ G' @
  4. *" }0 ~8 p+ P( g& w  j5 k0 t
  5. * brief  EDMA3 Test Application" }% ~  c+ X1 N& H* Q2 @7 m
  6. *
    0 J) r. _/ c/ B5 Z
  7. *   This file contains EDMA3 Test code.
    : }4 E$ ^" [3 ~& h$ K1 O  O
  8. *7 O0 {7 l4 N  E6 `8 ]  @3 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ f) U% Q% m# w% J, f% l; m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ D# n+ I1 b  H
  11. *         TO CHANGE.2 O* [( D/ ?* B; J& s
  12. *
    ! d- @$ b6 R* Y$ f" S1 X, G; a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ \% Z! p6 P  F! v7 \3 A
  14. *
    3 X; W0 {; [' z( c' _* m
  15. * This program is free software; you can redistribute it and/or# w7 a% h7 T9 i5 ~; N8 I& q
  16. * modify it under the terms of the GNU General Public License as
    ; B& ]/ j' [9 H* j
  17. * published by the Free Software Foundation version 2.# |' M: c0 j; f6 K' G! ?
  18. *1 {, ]7 Q8 v! h5 T' }  ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 @- e/ O3 w  x% V* M* B
  20. * kind, whether express or implied; without even the implied warranty; W$ L  E) ^9 o9 v6 d$ s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' R' |( t3 D9 ~* J
  22. * GNU General Public License for more details.
    $ j- r6 S" v4 i+ {% X0 a; i
  23. */+ R' t# a9 P7 V5 Q) D5 K. \

  24. ( O* K# C9 t# H
  25. #include <linux/module.h>7 R: {5 W- u: u4 q" P( z9 g
  26. #include <linux/init.h>
    7 L& D% C& C: b3 N7 w0 e& R% L7 d
  27. #include <linux/errno.h>
    ( v$ w/ H) Z" I  t! @
  28. #include <linux/types.h>
    / l7 o* [, _) {' N
  29. #include <linux/interrupt.h>
    $ a: |1 g3 l: p2 L- O( m6 F
  30. #include <asm/io.h>. [9 [* C' Z/ y1 @/ S# E
  31. #include <linux/moduleparam.h>
    6 b8 y; o. e# t( L/ a1 X
  32. #include <linux/sysctl.h>
    , h  P; k& n( T
  33. #include <linux/mm.h>6 P, A8 x3 F! l' d. v& ~) q
  34. #include <linux/dma-mapping.h>
    $ h, @$ i0 x2 R* J$ ]; Z' O* O

  35. 9 H- B, M0 n; ^! M6 ~- ~" V, \1 _1 U
  36. #include <mach/memory.h>: O7 ?4 A6 M0 w+ s5 e  O+ x- M
  37. #include <mach/hardware.h>
    5 g3 e3 \' q$ ~; `9 F0 k7 j7 H
  38. #include <mach/irqs.h>
    8 }0 c, U6 q( ~. @% h
  39. #include <asm/hardware/edma.h>
    ' g$ q! C" t; Z3 M$ c7 I; D

  40. 1 y* u4 P  m2 I8 I2 A
  41. #undef EDMA3_DEBUG
    + l% T' R2 W6 C- B7 |5 m
  42. /*#define EDMA3_DEBUG*/' }* ~& u* Q" o# ]

  43. 1 M, f6 Z/ x$ d% I
  44. #ifdef EDMA3_DEBUG
    ! V; L( x$ @+ z+ N, A/ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % W8 M1 I( @' E+ ~% m) B2 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ g6 q" Q9 h; _# W7 N; P8 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! j; U. X; w( J1 W1 q( p8 }
  48. #else- {& [% W' B* e. e0 |
  49. #define DMA_PRINTK( x... )
    , c/ l+ A$ K2 C1 P; x8 t
  50. #define DMA_FN_IN
    : t9 ~6 H. L5 ^8 f$ y* b/ S
  51. #define DMA_FN_OUT0 F8 c# r4 q, [( t/ E" I6 Y' _+ F! }
  52. #endif4 y4 l# y4 Y' b2 k2 B$ ~2 j
  53. . n' f) z% V% E+ O3 ^! N/ F- Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), E# {4 N8 ]- ~/ e" z- ?0 p
  55. #define STATIC_SHIFT                3
    ) C6 @7 s, \8 P
  56. #define TCINTEN_SHIFT               20& p( Y! K+ F! l0 ]7 R5 F! {6 c
  57. #define ITCINTEN_SHIFT              213 Q, ?$ s9 J4 R. p$ D( k. p9 T+ m) F
  58. #define TCCHEN_SHIFT                223 v4 u4 y2 P/ M( b" p/ m
  59. #define ITCCHEN_SHIFT               23
    5 i: p* v. q8 z: h* ]# ]7 e& S

  60. . E6 m9 S9 c9 S9 m% S! @- d& ~: u
  61. static volatile int irqraised1 = 0;
    9 N: v  O  X4 c# M
  62. static volatile int irqraised2 = 0;
    - ^# J5 f; t( t1 r

  63. # m& Z: x) v3 k  K; S* y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 B* R) o, h! `. {1 {$ v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , {! d* z) F5 W6 g4 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 B5 A, Z/ W0 u" f9 }$ X
  67. : d0 l& [7 l( ]2 X& k: n/ `
  68. dma_addr_t dmaphyssrc1 = 0;  U  p  W& ~6 u$ E; N
  69. dma_addr_t dmaphyssrc2 = 0;% _6 }% _% V  f
  70. dma_addr_t dmaphysdest1 = 0;
    ; l7 M, e" f* F! b7 e; z
  71. dma_addr_t dmaphysdest2 = 0;
    - g  D, L& R( {# W- B

  72. 2 ]- O, u3 f1 g, {
  73. char *dmabufsrc1 = NULL;
    / e! O* ~3 f( f" m5 s1 u0 G
  74. char *dmabufsrc2 = NULL;
    2 E: x, ^. H4 M% F6 a% b- G" s
  75. char *dmabufdest1 = NULL;
    9 M& J( I  C5 B0 k5 x
  76. char *dmabufdest2 = NULL;- k' ?1 S2 j# X) x
  77. $ l) w+ U6 Y% q
  78. static int acnt = 512;
    * r: g: P6 S3 e0 x9 z" C
  79. static int bcnt = 8;$ ^9 z* ^* r1 v2 J8 I
  80. static int ccnt = 8;
    $ q0 e& b" }  I) m

  81. ) r9 X! J8 O+ e% C& J
  82. module_param(acnt, int, S_IRUGO);
    7 |! w+ T  B# x6 j# q
  83. module_param(bcnt, int, S_IRUGO);
    ( h, ^) U2 g- V, ~% v' P/ {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( d  Z0 P5 {8 O# h: ^$ v4 q3 ]
; g) w9 w6 L1 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ O+ L: e' H- larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# D7 S. B+ B  S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ A7 N; g, a  [. I, h
# N9 h3 X1 [* j3 ^/ l$ L

7 Z0 C& H( x% _  w: L6 V+ ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 00:14 , Processed in 0.040962 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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