OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# [6 d" P" S' m1 |* l' l
  1. [code]EDMA sample test application
    9 \5 M9 t/ d: C, `  Y
  2. /*
    / q. @& H, a9 J/ B$ x0 w/ b
  3. * edma_test.c
    . U2 u# f, Y( i+ b
  4. *
    3 ~6 t2 I, X  p  k0 K( S
  5. * brief  EDMA3 Test Application$ S0 I/ B0 X4 E$ H& J5 h( ]+ n4 }
  6. *
      _. N+ J. W# l8 ?- `# X
  7. *   This file contains EDMA3 Test code.$ s7 f" g) y! ?% d
  8. *
    4 `. b7 f8 O3 k! s) `1 h/ T2 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& n8 Q, A7 v; E/ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& f8 Z8 L5 F! w" k* K
  11. *         TO CHANGE.; ]8 V: x  c* ?% c" S2 e
  12. *
    : P3 J8 C) O# T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p( t7 x/ I% A! ?8 @
  14. *- o& Z  U5 L6 t7 _' x9 W
  15. * This program is free software; you can redistribute it and/or8 q/ D+ T4 E! I
  16. * modify it under the terms of the GNU General Public License as* L% J% _- P1 L) J4 D& b# B
  17. * published by the Free Software Foundation version 2.; L& r) F( p+ W! P9 F9 a' e/ Y
  18. *, F# M. }. k  ]: n+ G4 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , H$ `2 m; H1 c- D6 |& L! w
  20. * kind, whether express or implied; without even the implied warranty5 ~1 a2 W, U, Q, j# G" s1 k$ D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . a0 M/ O# w: ?* Z, c8 K
  22. * GNU General Public License for more details.  w: M+ o3 p% m  x6 X
  23. */, Z( b" E% F  o$ m# v

  24. ; T' i$ G( I9 C  H9 q
  25. #include <linux/module.h>
    " F2 c6 c/ p% h3 Z3 U3 ?' x( f* h: U3 {
  26. #include <linux/init.h>, g/ U5 y* a. p8 C) l' D  @
  27. #include <linux/errno.h>
    ! @  U, S/ ?9 g* ?  A: S
  28. #include <linux/types.h>$ j$ I5 Z+ E* W2 V& |% ^- l) T8 Z
  29. #include <linux/interrupt.h>  v) R0 ~) b+ |5 v' x: h% w
  30. #include <asm/io.h>; `+ z4 P$ o0 |" N: S
  31. #include <linux/moduleparam.h>  Y7 D. f% G0 o- w
  32. #include <linux/sysctl.h>
    ' A& y( i$ f3 t' ]' P
  33. #include <linux/mm.h>
    ! e7 c0 c* x2 G7 H
  34. #include <linux/dma-mapping.h>8 n& T8 d$ O! z+ \9 @! U, @7 `

  35. * z' r# z; e: ?  ]- I# G
  36. #include <mach/memory.h>9 c. o. F/ q$ _
  37. #include <mach/hardware.h>
    ; P$ @5 r- ~% ]
  38. #include <mach/irqs.h>7 o& ~3 ]  Q+ L# n7 c
  39. #include <asm/hardware/edma.h>
    ; E, y, Q' M( C* t  ^$ G
  40. 1 P! x4 j! e3 b( o" _
  41. #undef EDMA3_DEBUG
    % q8 l9 _* D9 B1 F5 b7 ]( @- \
  42. /*#define EDMA3_DEBUG*/
    $ A1 [( G7 k  j  B5 N+ {. R0 f( K
  43. 3 ~. v3 v4 ~, q7 X) ^3 v% k
  44. #ifdef EDMA3_DEBUG
    ( x/ i& j5 n, t  S1 z8 W0 O% ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * z. _0 _8 }: C- a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 H9 y# S8 h- C" P0 B( B$ i# a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 p1 W0 R3 W( m2 U- }
  48. #else
    $ K" v9 P) {# J* A
  49. #define DMA_PRINTK( x... )6 z. v  `. u0 D# h4 ]
  50. #define DMA_FN_IN' N" u$ G! j% s: l2 L
  51. #define DMA_FN_OUT
    2 a: z# W. y8 W& I( h. w
  52. #endif0 R) G( Q; f# G6 S- E$ k3 K& W

  53. ! G1 s+ D1 T# e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' B- b+ w7 f: A3 p4 r" Q! @1 Y; a
  55. #define STATIC_SHIFT                3
    # _# n! D$ H' y
  56. #define TCINTEN_SHIFT               20
    : H( D$ r" t8 H8 {4 y0 A
  57. #define ITCINTEN_SHIFT              21
    - l) `6 }, j& l7 a/ i. f+ h7 u
  58. #define TCCHEN_SHIFT                22
    2 A& b$ y0 V1 _+ {. T( a: N, i
  59. #define ITCCHEN_SHIFT               233 i0 }/ M3 F3 g) B

  60. ; n  J7 H: l/ j  @. y% K  t
  61. static volatile int irqraised1 = 0;7 [. K+ \# ?; N# f2 r$ b5 G5 ?+ D
  62. static volatile int irqraised2 = 0;' z3 v0 `! d# f7 S  I7 O
  63. : X6 ]1 E6 ~: _( y! m% b; J3 o6 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m% S' u5 z2 x% B5 c: C& ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 @* E& g* i+ o5 B1 N  G3 k0 s+ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S; {6 }8 c+ M( a2 a9 l4 {
  67. , @, z& b! d: B
  68. dma_addr_t dmaphyssrc1 = 0;
    - }9 i2 }, O# o* p8 t
  69. dma_addr_t dmaphyssrc2 = 0;
    . k0 ^! a/ B" J0 L0 y
  70. dma_addr_t dmaphysdest1 = 0;9 P9 {' C0 `" ^- @) ?& X+ m
  71. dma_addr_t dmaphysdest2 = 0;
    ; J2 m6 S5 z- S; |
  72. : p9 S; x; c1 L
  73. char *dmabufsrc1 = NULL;
    $ e5 p& Z) q3 H! n
  74. char *dmabufsrc2 = NULL;
    ( x% r# @0 a3 c) k) Y! ^
  75. char *dmabufdest1 = NULL;/ K4 d# J* I! u, i; n
  76. char *dmabufdest2 = NULL;3 Q( z8 S( I# }( L6 @1 O+ h2 \* D

  77. 5 l! E0 z. s; Z& A1 f7 Y3 u
  78. static int acnt = 512;# Q2 s2 {) E; `
  79. static int bcnt = 8;9 }. o, Z+ {7 n6 o- a; ?$ b
  80. static int ccnt = 8;
    4 e  V; R$ I+ c, E

  81. ; j/ W3 @) M/ V" y! p0 _
  82. module_param(acnt, int, S_IRUGO);
    6 }/ J+ e0 r6 x  o- v1 b  R% q4 W
  83. module_param(bcnt, int, S_IRUGO);0 X: X) Y* X1 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; u# Y/ |, H7 _* N& f5 ^% s
2 S# y2 ^: K' Z2 `$ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 N: R/ S4 C  g' Y* N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 S. _; f9 m0 h, O6 ~( H) V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 }/ L$ ~( B" Z$ r- c) O
1 [" j7 v4 ^$ _: ^
9 a+ R% s  \3 }+ ^# Q" f2 G( r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 23:16 , Processed in 0.037047 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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