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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( q% h  b' g9 S) m! t6 l
  1. [code]EDMA sample test application
    9 f% D/ W2 E# z9 s% R
  2. /*
    5 {8 j; M. d. x, Y
  3. * edma_test.c6 a# D7 H6 f7 b% k2 u- I
  4. *+ s4 ]5 i' T: D2 \( E* ]6 U  ?
  5. * brief  EDMA3 Test Application
    " ^/ d- P/ G9 u- Y
  6. *
      k& o2 ]! T# D1 r
  7. *   This file contains EDMA3 Test code.
    $ b7 U) Y5 o5 F, l+ P! \
  8. *
    # Q9 Y  G* F8 F8 k! w  q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 S, N( W9 d7 o) n8 S) K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      T0 ]  `; g' {( a
  11. *         TO CHANGE.9 b: h% _: l* e' o7 ?
  12. *
    5 g; T# M/ J4 I" u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  j6 w5 s; o; r/ h$ h
  14. *5 N# L+ S$ c  |
  15. * This program is free software; you can redistribute it and/or
    & V0 l9 z, B3 S3 o' |
  16. * modify it under the terms of the GNU General Public License as
    . T) K6 s+ Z& J
  17. * published by the Free Software Foundation version 2.0 J2 b- a8 m" x
  18. ** z/ {. e( Y% n2 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 [2 l5 A  [& |4 t# m0 p  v
  20. * kind, whether express or implied; without even the implied warranty
    % j" `. }0 G2 p* H* m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) k" |% W/ Z0 u9 Q$ r0 {/ M3 j
  22. * GNU General Public License for more details.  j, _( Z; N% E1 r/ t
  23. */
    9 T2 g( n9 F3 a: W  t& [
  24. : O& ~/ `& _, q6 a
  25. #include <linux/module.h>' r* x( {% d/ w4 ]) F
  26. #include <linux/init.h>$ a1 j/ i+ |7 n1 l0 m3 D
  27. #include <linux/errno.h>
    & a& ?4 L! r4 M9 W# O
  28. #include <linux/types.h>
    2 b8 g( `% R6 s+ ^
  29. #include <linux/interrupt.h>
    ) ^3 l$ h5 G" ]
  30. #include <asm/io.h>
    ! D4 f* l3 S8 R" f( F* m
  31. #include <linux/moduleparam.h>
    + ]4 r& B( f4 |
  32. #include <linux/sysctl.h>, H0 n& q  J: B8 {
  33. #include <linux/mm.h>+ i- L3 i9 F1 a: R+ z/ W/ n
  34. #include <linux/dma-mapping.h>9 V8 A& L: ?# H  d  ?" g' a- j

  35. . @% S  r' h2 X+ C# q: f
  36. #include <mach/memory.h>
    / G1 w( P9 d( z1 L4 g3 r
  37. #include <mach/hardware.h>. [& V7 ]# k* c, h# {+ q
  38. #include <mach/irqs.h>
      }' l/ ^$ u3 l( |5 m! g1 P
  39. #include <asm/hardware/edma.h>, t3 j2 O+ I: b, @( V& [: }

  40. 8 `" x, |8 W# n* l
  41. #undef EDMA3_DEBUG
    ! [8 K2 M) m# {
  42. /*#define EDMA3_DEBUG*/
    ' v! I& I! P$ {" a3 z; o
  43. ; B- b/ C4 _5 @6 k' y, Z" o
  44. #ifdef EDMA3_DEBUG3 [* [) S& c$ k+ F: c/ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      l8 \  o4 q  W* e$ \9 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & E8 [8 i$ a& ~8 ^- `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) f( G% U" S2 |* z4 I3 F
  48. #else9 e2 e" G, d9 Y3 W) l
  49. #define DMA_PRINTK( x... )
    4 K# V- |, z" s: h' R
  50. #define DMA_FN_IN
    ) m$ P9 F' `$ ~0 i- O* C' {3 Z
  51. #define DMA_FN_OUT
    + F& J4 U) l5 |6 U( l
  52. #endif
    + @( v1 e% T4 n" U! n
  53. : s$ M  f; X( t! M8 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ A  Z; V# `+ ?' ?( T  C6 N
  55. #define STATIC_SHIFT                3
    & E. s7 T: Y* a* l2 A0 x
  56. #define TCINTEN_SHIFT               20% A0 _! r( ]$ S' l" |
  57. #define ITCINTEN_SHIFT              21/ E1 i" I; T& F& e7 `, x
  58. #define TCCHEN_SHIFT                22) N5 S: `: c( Q+ v2 f
  59. #define ITCCHEN_SHIFT               23  U* Y$ Y' j% p  g3 I
  60. # y% u5 g8 X6 x" ]; D
  61. static volatile int irqraised1 = 0;: v, Q5 _/ h% y
  62. static volatile int irqraised2 = 0;' m2 K# }/ D; `1 n6 x9 I

  63. , c. U4 }* a9 G6 ], y. I3 n2 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i7 m# \2 g! T! f; ^3 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. |0 g3 S9 [. p! y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i+ `4 L" \% z2 P6 j( z5 ]+ S

  67. $ h& P9 x* L4 a3 i
  68. dma_addr_t dmaphyssrc1 = 0;" A1 E; V  T/ Y3 A
  69. dma_addr_t dmaphyssrc2 = 0;; c+ I. h0 _9 M: L7 w: ~/ E3 b4 Y
  70. dma_addr_t dmaphysdest1 = 0;
    * ]( {0 e5 T" q$ m: E
  71. dma_addr_t dmaphysdest2 = 0;( Q# q. P8 l! f

  72. 6 P9 l  f; J* C+ |, y" \. k' T2 Y
  73. char *dmabufsrc1 = NULL;  i9 d2 `. V, h) Z
  74. char *dmabufsrc2 = NULL;% A  ^7 \7 b- ~/ [% Y' q# b9 ~. j6 l
  75. char *dmabufdest1 = NULL;
    ( O: b, A; l& F  J4 q* G
  76. char *dmabufdest2 = NULL;
    5 ?" t5 o% ?* O) a3 h

  77. + q( p" x- o' n0 T
  78. static int acnt = 512;
    + Q' `" v- Q7 l8 Z* h5 j
  79. static int bcnt = 8;
    & n; B# L7 Z( w. J! {2 c, \
  80. static int ccnt = 8;
    " r  b6 k5 ]% W; t% n! o/ v7 k
  81. 5 S$ v# L/ [! Z: h! m& ~
  82. module_param(acnt, int, S_IRUGO);6 a3 o2 C, g4 s7 l- `
  83. module_param(bcnt, int, S_IRUGO);
    9 ?/ e# x, Y/ I* S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" w: p/ r8 J+ r" s- ~* i; j; \

5 G7 R" ?1 {% E- P7 N. n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ~% j, D0 s- L! u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ H1 d' V5 ]1 M5 x1 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" n6 \" g# G0 ?, {5 l

7 w0 N, f2 Z% o0 \% a  Z5 h- O  k- X( }9 Q- c0 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 08:46 , Processed in 0.039442 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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