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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 v( n$ K" d" p3 C
  1. [code]EDMA sample test application' ?7 y9 h0 L4 S5 l2 N
  2. /*
    0 J$ S  |/ }- r. ]6 ^/ C. q. ?
  3. * edma_test.c$ }4 Z- l! X" g2 G" k2 O  Z
  4. *( O. G: T+ W2 R
  5. * brief  EDMA3 Test Application0 u+ j7 `& X. N4 t4 ^) r
  6. *
    & z; h# E" ^( [, G  p
  7. *   This file contains EDMA3 Test code.# o  S. ^0 N$ e8 L4 e4 \8 d3 ^( ]) z
  8. *; v; |& q* }% n- U8 f" s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / X6 T3 T; C& ~2 z2 Q7 [- R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : h4 t+ Z) V6 g4 ~
  11. *         TO CHANGE.2 p3 \( ~* ]0 Z. `: [
  12. *6 o' ~1 N8 X# A) @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + h# K5 m  J9 D, G
  14. *5 l! E7 C2 A0 ]; h
  15. * This program is free software; you can redistribute it and/or
    & {1 r) X0 e/ g# r
  16. * modify it under the terms of the GNU General Public License as
    4 v( u7 m. W8 K' Z* J3 `
  17. * published by the Free Software Foundation version 2.( g* G$ J8 [& h7 T; ]( M
  18. *  P; W  F1 x+ h, m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ G( k! E8 e5 x( f8 S
  20. * kind, whether express or implied; without even the implied warranty; S: z4 w$ T' n' r1 }1 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  I3 d7 `  D% l' k9 I! X; k
  22. * GNU General Public License for more details.
    * R; F' }: h# F$ K/ L
  23. */( a4 r! k# r3 \, [6 t4 e6 o

  24. 3 @0 j/ h/ @9 N( g$ q  I( M
  25. #include <linux/module.h>
    + @& a! B" w7 s5 {0 Y; x& J
  26. #include <linux/init.h>
      l1 f6 r( H9 W7 V
  27. #include <linux/errno.h>
    , s" q% g. N$ E" h2 g8 o3 c
  28. #include <linux/types.h>( q' {( q: f/ ?  B4 ]% P+ l
  29. #include <linux/interrupt.h>, H; s; D4 A# ?+ F
  30. #include <asm/io.h>
    ) H5 E9 l; d0 ^
  31. #include <linux/moduleparam.h>
    ' j# O7 u5 w% ^' y9 ^" F
  32. #include <linux/sysctl.h>, ~2 q7 Z% e' \* w8 E
  33. #include <linux/mm.h>
    ! x* j5 O) X9 @: I2 a* Q4 i$ Q
  34. #include <linux/dma-mapping.h>
    % g' y* U0 r9 ^6 G1 j
  35.   ~  g; u2 _9 S
  36. #include <mach/memory.h>
    7 l% m8 J% U; M# L7 h2 n
  37. #include <mach/hardware.h>3 C2 A8 D1 ]8 m0 s3 q; n2 @
  38. #include <mach/irqs.h>
    0 M" K1 Y. t% p( O# K
  39. #include <asm/hardware/edma.h>5 }3 [/ R- ?! }7 p9 d4 O0 c3 {
  40. , M! N" h) o  d% I. h5 S' U
  41. #undef EDMA3_DEBUG
    1 n" D5 W) ^6 D0 F+ J
  42. /*#define EDMA3_DEBUG*/
    . V4 L1 y, q+ P  R% }" S

  43. 8 @. I2 J2 r5 ^! e3 ^
  44. #ifdef EDMA3_DEBUG1 F6 D* W$ p' {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& V  N1 H) D+ Q  G$ ^8 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 @4 K9 ?& D. c9 ^5 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ |4 `; l0 g2 L, v+ x6 `
  48. #else
    % H4 F& K+ K+ Y; V  X/ S
  49. #define DMA_PRINTK( x... )
    . ^! X. C1 \5 \
  50. #define DMA_FN_IN$ b2 Q: a1 y8 g0 B$ R/ s" v) U
  51. #define DMA_FN_OUT
    ' ~0 @$ E+ F; }- I8 I
  52. #endif3 F6 J3 v& m+ A% p* h9 ]$ o

  53. 9 X# s9 w2 T# m+ n: r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- f$ F+ R& l& K' P/ ~) y) ^1 f
  55. #define STATIC_SHIFT                3
    6 G/ H" w* |) y+ t0 {
  56. #define TCINTEN_SHIFT               20
    # t$ ?6 f3 O! F0 g' ^  G% N4 \
  57. #define ITCINTEN_SHIFT              21) f& C4 J+ N% o$ ~4 O  j
  58. #define TCCHEN_SHIFT                22# X9 a& X* s( q) ~
  59. #define ITCCHEN_SHIFT               23
    + a9 Y- N7 h. |  X

  60. 8 ~- y8 b# \$ n/ h$ W
  61. static volatile int irqraised1 = 0;
    % E3 P/ {+ L+ z" U2 b3 r2 X6 i( N/ E
  62. static volatile int irqraised2 = 0;
      N4 e6 V8 Z: @! T: l' O
  63. ' ?2 ?; e! A2 y4 A, F3 M8 p9 m4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I# J% X: I. m+ }1 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ f. p* ~" _1 K& N0 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C: L9 k& a* Z( y% G# E
  67. " C( I) D$ o3 A2 q; E
  68. dma_addr_t dmaphyssrc1 = 0;% X% E$ B% H+ _
  69. dma_addr_t dmaphyssrc2 = 0;
    " Q3 ~4 g1 _+ H0 j/ m3 j) C& p
  70. dma_addr_t dmaphysdest1 = 0;
    ' D* H) u$ t: r3 b
  71. dma_addr_t dmaphysdest2 = 0;
    # A0 V. C0 G: @. a4 ?6 p6 u: H" F9 ]

  72. ( L) r5 K; X; P* Q( l
  73. char *dmabufsrc1 = NULL;/ o9 e/ M+ y! d; D* D0 [6 k2 b
  74. char *dmabufsrc2 = NULL;
    ' _. ~' ^* D( W! G
  75. char *dmabufdest1 = NULL;
    # v% e4 {, X# o$ d0 Y
  76. char *dmabufdest2 = NULL;
    3 ]+ K6 L* ?  K. o

  77. / @# B6 _/ M0 o! y6 W
  78. static int acnt = 512;
    ' @9 B. a# b( n; P8 Z9 [" p
  79. static int bcnt = 8;+ }  q" T4 d6 @+ _3 V
  80. static int ccnt = 8;
    1 O6 K5 x4 y: L2 V, J' m0 z
  81. ( E, s* [9 S8 t' B* A
  82. module_param(acnt, int, S_IRUGO);, \6 T" A, Q2 I* k" ~1 s7 X; D& L
  83. module_param(bcnt, int, S_IRUGO);
    4 a8 @( r! ]8 _0 U. i& O9 S3 [* G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! b7 Z. x3 Z: W# c9 X7 Z) _6 c/ [! k9 F  Z, `' q2 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 y2 R7 {1 `* p& W6 \7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ x* J$ [6 U( e6 W/ T7 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 w/ v! j8 k# ]; z" C" x9 O6 W: l2 o

0 m: [* D( s* V! j0 V( ~8 Y. h7 F3 I
. H% y2 J& n* [5 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 23:03 , Processed in 0.041800 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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