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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " p9 z! g5 q# T% F/ J
  1. [code]EDMA sample test application' [4 @8 K2 c. _5 a+ T, V$ T6 x& l
  2. /*+ X: p" x2 l- y, K  D$ e( l1 a
  3. * edma_test.c4 T# E8 @% L& A* q# o1 M
  4. *
    % a4 ?- |( V/ l6 @# x
  5. * brief  EDMA3 Test Application
    ! v# D2 T/ i/ ?  q. O5 ?
  6. *
    * {- R2 L8 }8 K! Y  b* D; t
  7. *   This file contains EDMA3 Test code.3 v7 t& q. U7 p4 G
  8. *# e# a1 S/ O6 r3 v' y/ N. T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. U6 s& H: s- E) ~4 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 }4 h2 G$ U# C
  11. *         TO CHANGE.2 O, u% B* ?4 {+ Y9 n" N* g# Q
  12. *
    ) g/ w" s( b! \6 ~8 Z) w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 b" [8 [8 C$ U, D! M$ A' t
  14. ** J! q+ P, J6 k& D
  15. * This program is free software; you can redistribute it and/or
      r5 t& k$ t. g& V
  16. * modify it under the terms of the GNU General Public License as9 F" Z5 M; p' b8 X/ ~' Y1 ~
  17. * published by the Free Software Foundation version 2.8 O  l; l# Y8 F* b
  18. *9 H8 T, z, X/ O1 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 _/ u5 f( ~! e3 A1 H  b; z" s
  20. * kind, whether express or implied; without even the implied warranty
    ! a( @, K" n& ^. S+ Z5 R4 b: o! M+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' i# _. r5 i9 f$ S
  22. * GNU General Public License for more details.
    $ H+ T& `$ M1 n5 d2 {
  23. */
    + t& ]! T6 R) e
  24. - Y, v$ I1 w* I. |+ o
  25. #include <linux/module.h>$ g) W: L. |; @# O  y# U& l
  26. #include <linux/init.h># L  |7 b( s% |1 w. b. M2 w
  27. #include <linux/errno.h>1 j4 b- H# g( |( ]6 F1 e- \
  28. #include <linux/types.h>* o+ z  b$ {$ `
  29. #include <linux/interrupt.h>; T5 z0 w+ C: f8 G" G$ G. {
  30. #include <asm/io.h>/ h9 j  L+ _& r8 I( T+ h! {
  31. #include <linux/moduleparam.h>: B+ _2 k/ \$ V5 A7 L% n1 l
  32. #include <linux/sysctl.h>
    3 A1 k' p  G- Q8 _
  33. #include <linux/mm.h>
    $ t6 L5 q8 K5 H4 c% U- q
  34. #include <linux/dma-mapping.h>
    ; _) B- }! M6 g: f3 m3 J, S

  35. ( u6 Q( I+ l7 E3 d
  36. #include <mach/memory.h>
    # t7 s5 H0 k0 c9 ~0 b: v2 F
  37. #include <mach/hardware.h>
    - t9 H8 j6 S3 G' y
  38. #include <mach/irqs.h>
    1 O: D: q5 R5 g6 [
  39. #include <asm/hardware/edma.h>9 c7 v4 B- [" K

  40. 5 \2 L' v, L( G7 e  j" [- \
  41. #undef EDMA3_DEBUG
    4 I" Z7 V, Z+ R( Y$ a7 N
  42. /*#define EDMA3_DEBUG*/2 K- M7 P( e, r' [9 M- i
  43. 5 k2 v1 P+ H7 \* u4 \
  44. #ifdef EDMA3_DEBUG+ \# ^3 W, |; s* E3 \3 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ^1 b" L5 Z7 ^2 ?) S8 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j+ u8 u. `# u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % K* E: c, s! _! c# O  T5 O
  48. #else
      f& T1 _- y8 p& ?
  49. #define DMA_PRINTK( x... )
    " S3 t8 ~7 {, B% R
  50. #define DMA_FN_IN
    7 Y. Y1 V, a# i/ v/ b. h
  51. #define DMA_FN_OUT
    2 G. ?# Z5 L$ b$ q9 }# }
  52. #endif7 L$ M& t: L& d, }! I, m7 r
  53. ' D7 t/ u0 T* N. g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! p& E: ~" y4 D! _7 F
  55. #define STATIC_SHIFT                3
    8 e; \' |" t. R
  56. #define TCINTEN_SHIFT               20. \: t; ^4 P/ X7 e& b
  57. #define ITCINTEN_SHIFT              210 D. j1 c( \: F' }+ ]& @
  58. #define TCCHEN_SHIFT                22
    2 w; S( A9 Q4 y& N6 P5 z9 W
  59. #define ITCCHEN_SHIFT               23( O- p3 r7 ?2 ]: T4 P' H2 S
  60. 3 F5 P0 |1 N5 x4 N& }* K
  61. static volatile int irqraised1 = 0;+ r! p. x! L8 J% e4 E2 w
  62. static volatile int irqraised2 = 0;# o1 x8 R4 o+ O6 c  C2 k- @5 G

  63. # D. i' P& S1 T: J* X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. }" D& n, k* D- q$ ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A9 r1 ^- m5 Q+ A# v5 k8 x0 W" e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : U7 b1 X* O% N
  67. ! e3 j3 e' A' g6 C! R
  68. dma_addr_t dmaphyssrc1 = 0;# G- A4 B+ c! q" X# F, \: E
  69. dma_addr_t dmaphyssrc2 = 0;3 P& l4 B! o* O/ h& h- S
  70. dma_addr_t dmaphysdest1 = 0;/ `  u/ t: b, s7 n/ h' {  j
  71. dma_addr_t dmaphysdest2 = 0;
    ( I6 I7 @7 O7 g! Z5 @1 L
  72. # h) F! \7 H1 p5 m: p, Q
  73. char *dmabufsrc1 = NULL;; W* \! Z9 B* n1 S& X' {
  74. char *dmabufsrc2 = NULL;0 E, g# k8 @: l5 `4 s; S
  75. char *dmabufdest1 = NULL;
    - V7 o) [+ M4 Z2 N# V: Y+ g! M6 W
  76. char *dmabufdest2 = NULL;8 `: o5 B% A7 c" N
  77. 9 |) W3 l4 m$ n# z
  78. static int acnt = 512;
    2 T4 J6 m! b5 Z! J* P7 j9 G
  79. static int bcnt = 8;6 R: D! D2 I& U5 X: U
  80. static int ccnt = 8;
    ( ]/ f; H6 z4 [- u& k
  81. % }0 `0 J4 ^! y3 U; G2 O% N3 Z
  82. module_param(acnt, int, S_IRUGO);- W6 g* P" A4 M
  83. module_param(bcnt, int, S_IRUGO);8 e4 S8 S$ n# E+ ]  f2 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 \. d' M' o. T6 k1 E
, k8 Z2 q. D6 Y3 G* u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  E6 Y- L, E/ K( T: i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 s/ E- ~8 D! s% Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: @: n3 M. ~' Q+ H+ P! h1 `  a
0 k8 j4 }7 f5 |" y- Q4 F- F+ J$ Z. h8 g) `+ K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 19:50 , Processed in 0.038793 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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