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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ I8 I! r5 L* D1 \, r
  1. [code]EDMA sample test application
    . \0 T* }, y3 F! V/ N
  2. /*4 }4 ^: g* n/ V6 i! H
  3. * edma_test.c' l$ u4 y7 }9 y) |0 {" |
  4. *; }# U; M6 x# y  ~3 I' j) @
  5. * brief  EDMA3 Test Application, Y6 b9 |3 Y- o7 Q
  6. *
    4 j$ ^6 R" \- r7 a+ j( y% i4 S
  7. *   This file contains EDMA3 Test code.
    1 C" s+ r9 {3 I) \9 W
  8. *
    7 B" q; |: d5 c: h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 N2 p! X( \, i. z1 |$ D4 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: b4 u( y* ?' s6 ^. d+ b7 o
  11. *         TO CHANGE.4 f. m% j- j) D# }
  12. *
    5 E! ]1 g  ^; p( b9 G0 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 f( M" l8 p8 Y, n
  14. *; V4 L1 z" I# m
  15. * This program is free software; you can redistribute it and/or
    + n0 L& i3 o$ F# G
  16. * modify it under the terms of the GNU General Public License as- u, `5 r' ]1 ^, }
  17. * published by the Free Software Foundation version 2.
    7 }% v8 ^0 t" i; M( v
  18. *- |. X( {& ^! M4 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- f; l5 M+ D" `# F2 @  c& R  p
  20. * kind, whether express or implied; without even the implied warranty+ N) ]0 C5 i* G5 o! k6 k1 ]% \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 u4 c3 @4 v3 c6 W
  22. * GNU General Public License for more details.
    9 L8 ^* C$ Q7 P' I
  23. */0 G$ F8 U, M: ^' p* @0 Q4 F7 j
  24. , p: [; J1 l: {- {1 x
  25. #include <linux/module.h>
    # s3 G9 t  R9 L$ n6 M; v2 x
  26. #include <linux/init.h>
    # p+ \' L  P- J
  27. #include <linux/errno.h>
    2 W# g2 D9 Q9 Z" C7 _: I$ B6 x0 Y
  28. #include <linux/types.h>
    ' ^! e2 X6 V0 U0 p5 E$ _
  29. #include <linux/interrupt.h>9 E+ u  d' \  x" {0 C
  30. #include <asm/io.h>
    4 n* k0 a7 o2 o
  31. #include <linux/moduleparam.h>
    " _  Q4 `2 E' {% ~# r; d
  32. #include <linux/sysctl.h>
    5 ^8 p" {6 X$ P+ J
  33. #include <linux/mm.h>6 j; [" s$ z2 p- i  c
  34. #include <linux/dma-mapping.h>
    6 ~9 x2 l2 B9 F1 [! q% I

  35. # G4 ^) P! Y( F8 p( M% E/ [
  36. #include <mach/memory.h>
    & l# \2 \* X# S+ m9 g
  37. #include <mach/hardware.h>
    & b# P& D2 @! L# |7 r
  38. #include <mach/irqs.h>3 v# F0 o! m" C" j. t  [
  39. #include <asm/hardware/edma.h>
    $ y4 Z0 ?1 y5 M% s( E5 m1 b& w* G

  40. + Z! Y: T6 @$ x) Q: o5 ?
  41. #undef EDMA3_DEBUG. D4 x- j0 j9 r9 V* {7 v' k
  42. /*#define EDMA3_DEBUG*/8 a( Y# v1 l% A  h9 Y! b' B9 K# Y
  43. 6 L9 Z3 U- o! U+ v5 d1 I
  44. #ifdef EDMA3_DEBUG
    ' x; m! \1 @% i5 U8 G, }3 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; A; m- N9 s' u& B) ?3 y' }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; r2 `; T. ^" D4 G# Y8 }7 n: c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * o; N- ?: u( x
  48. #else. B& j! _! s; a5 Y6 t& e: C; b% t
  49. #define DMA_PRINTK( x... )9 ?4 W8 b9 K2 F
  50. #define DMA_FN_IN
    0 m$ H. P  \. w7 O1 k) l1 h  ?. }4 W
  51. #define DMA_FN_OUT/ j/ c2 F% w% O4 q: I5 [
  52. #endif) ~5 n8 {; x* J0 m7 N# }
  53. . y) V+ i, s& x# }* ~- Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! h( d, K- b# c- V
  55. #define STATIC_SHIFT                3
    0 x5 t3 r4 v4 T% o$ M4 R
  56. #define TCINTEN_SHIFT               204 D, h. h9 F/ g% d# w: E
  57. #define ITCINTEN_SHIFT              21
    6 Y% e! U& G. {
  58. #define TCCHEN_SHIFT                229 f/ L. [% D2 H8 K) O4 y# N
  59. #define ITCCHEN_SHIFT               23
    ' y/ [5 L: @. G3 |
  60. ! o) V0 l' |$ R# {' k
  61. static volatile int irqraised1 = 0;
    % i, ~# ~/ f5 J& H" D$ B
  62. static volatile int irqraised2 = 0;* O1 [9 `: Z" m& \4 x

  63. . b! q- k' ], B+ a, C7 k" Q3 V; n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E  W; O" H' ^/ T' `: P" l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! U1 D6 c; b6 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! m( H/ D- \8 q0 I4 p
  67.   I" s5 z$ M) w" s
  68. dma_addr_t dmaphyssrc1 = 0;
    ! l5 J* h& J( u- s+ e
  69. dma_addr_t dmaphyssrc2 = 0;
    - \! y9 |! P) ?! d
  70. dma_addr_t dmaphysdest1 = 0;
    , G7 N7 P1 O0 R) H/ s7 k
  71. dma_addr_t dmaphysdest2 = 0;4 C" G* C, @  q* P( u2 i

  72. / `' e7 \5 ^% e0 |: x, v
  73. char *dmabufsrc1 = NULL;7 ?  w) g, F; [2 Z8 N& o& l, k
  74. char *dmabufsrc2 = NULL;7 T4 z9 H, t2 R4 [
  75. char *dmabufdest1 = NULL;
    6 _, K% V- K, i, q$ P6 y  k
  76. char *dmabufdest2 = NULL;
    + [: [. N& v' L) _8 f# \: y" `

  77. - J) v& R* S( S( B3 W/ B& O$ O
  78. static int acnt = 512;- w) i) g1 W; g7 l+ S
  79. static int bcnt = 8;
    - R7 J* g+ e( P# p5 a2 D' k" x5 O% P
  80. static int ccnt = 8;8 a( f9 B& m4 [* K/ q8 q3 m
  81. # Y3 }" X/ t. |1 f
  82. module_param(acnt, int, S_IRUGO);7 B" \* s. I# U: s# p
  83. module_param(bcnt, int, S_IRUGO);
    & M( v/ M& y: J  c3 |2 {* L! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 b! w8 j& u, \* i3 K4 [8 e

2 {0 _% a* P  H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& Z; b+ a5 E$ d$ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 l9 l: \8 k, t* {( D, ]7 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 M0 z5 @5 N: n+ ^" ]+ Y* m

/ V9 a( @- u; ]5 {( n/ C8 O
: c0 j6 T: \. m8 R& q+ t+ M  ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 02:44 , Processed in 0.038680 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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