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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % q/ R1 y, [- w
  1. [code]EDMA sample test application9 H% B: F9 W6 A0 v1 m7 }1 e& ]6 b
  2. /*
    1 |; q$ ~7 `# ]  c6 G3 y
  3. * edma_test.c
    + o9 m: t# t! o6 c% v
  4. *
    : l7 }9 }; W" Y+ z# m* ?
  5. * brief  EDMA3 Test Application
    + O6 Y! B/ C; T9 c8 \6 o
  6. */ z8 E* j9 e8 d3 L$ R( K- ]  U3 X
  7. *   This file contains EDMA3 Test code.; r; z  n% p& O- I' ~% _
  8. *' U- O% F0 O- i5 v1 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 r/ [/ H  E/ A+ ?: z. i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. n/ c' @$ F7 H! w3 |* F! Y/ u
  11. *         TO CHANGE.7 c% M2 g- m; ^3 \
  12. *
    9 W! i- j, H" D- d4 y5 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , x# k% R' a/ F% L/ ~
  14. *  X% z2 O0 D+ _
  15. * This program is free software; you can redistribute it and/or; M: e+ w; ?; ~0 K0 j
  16. * modify it under the terms of the GNU General Public License as
    - `& t/ m$ V! ~, i
  17. * published by the Free Software Foundation version 2.1 z- D+ R- v! m0 f; W/ H% E
  18. *$ ]( q* s/ ~+ ]+ i9 s" K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - [2 y' D2 a0 g* K
  20. * kind, whether express or implied; without even the implied warranty; I- a0 N1 i  F( M" l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) t* [6 w. ^* A  J
  22. * GNU General Public License for more details.
    2 S) }% o, J' M& M
  23. */, L/ f2 P5 {+ x8 k5 j5 J
  24. $ i  f9 q, H0 U9 ]6 h
  25. #include <linux/module.h>
    . L: o) p3 M! g7 X' ?" @$ Z8 W$ p+ x! B
  26. #include <linux/init.h>/ {& g* C6 W9 K# O/ Q7 P
  27. #include <linux/errno.h>2 O% j% V9 S- E. T, J; `3 }4 Q
  28. #include <linux/types.h>
    , ~, o9 E* G/ }% ^
  29. #include <linux/interrupt.h>8 D; ^. v5 P# }* T" A' V" O
  30. #include <asm/io.h>' F, v  C0 J+ p$ t0 y
  31. #include <linux/moduleparam.h>
    6 p: l, t0 F! I3 P- E: |
  32. #include <linux/sysctl.h>& A2 S1 c& A+ m# `- V2 B! H  v
  33. #include <linux/mm.h>" i2 {9 h+ \( J" ~7 Z7 F4 o& [+ ]
  34. #include <linux/dma-mapping.h>! p% G( g/ b2 s

  35. 3 i7 a* S# g4 M( o6 _
  36. #include <mach/memory.h>
    5 U" J' v* n4 G" ^+ S6 {
  37. #include <mach/hardware.h>. c' u  @* ?) H3 F( ]9 l, N) c
  38. #include <mach/irqs.h>/ ?1 }/ f# S$ L8 e
  39. #include <asm/hardware/edma.h>
    ( C* R- ^4 T9 l+ L* `' k  C

  40. & q5 C/ a- J2 n- f% `
  41. #undef EDMA3_DEBUG% y0 N: n4 M" \2 W$ S
  42. /*#define EDMA3_DEBUG*/
    5 B8 e( p7 V+ u: Y
  43. 7 q- _4 A* S% e) f: C2 m$ `
  44. #ifdef EDMA3_DEBUG- w& s# V4 u: ~% V! T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ z3 u  a' v" V2 @6 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 O( @8 X1 \* a* B4 d: e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ^' \; `8 f6 X7 F
  48. #else  R3 @  X) \; U5 V, M0 P9 A* h
  49. #define DMA_PRINTK( x... )
    7 x( x  \" I1 z. u4 F+ M
  50. #define DMA_FN_IN
    % r3 V7 a/ P7 o+ e: C
  51. #define DMA_FN_OUT1 A' E5 C6 N$ T" q6 \  q- I
  52. #endif
    " g. Q5 C. @' n+ a, }+ S
  53. " ]2 c5 M  }2 _/ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & K/ z( ?# l- l: v1 }" R
  55. #define STATIC_SHIFT                3
    . @5 r4 k, r1 S; k
  56. #define TCINTEN_SHIFT               20
    / x& K$ g6 ^# y
  57. #define ITCINTEN_SHIFT              21
    3 F# L0 g, R* M# S! y8 f
  58. #define TCCHEN_SHIFT                222 w! F/ H* P8 l# L; u
  59. #define ITCCHEN_SHIFT               23! z. O+ T( D- d* ]3 w& K
  60. % ?5 D' p6 n$ v8 |1 ^* Y+ i
  61. static volatile int irqraised1 = 0;7 C$ L- w+ s  B, [5 `
  62. static volatile int irqraised2 = 0;
    - ]6 d7 ]; Y7 ?( J7 S) N2 @
  63. . U6 R4 p' m% d  T1 L% _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , _. [6 c" ]  B4 B; f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) C& l- ^% D5 U: ?& f: @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f$ {7 g- {, H

  67. , C. p* c% ?# o, U: N, Z8 c
  68. dma_addr_t dmaphyssrc1 = 0;4 S8 ^! w: E/ v+ ?
  69. dma_addr_t dmaphyssrc2 = 0;9 d& ~# y' e! W2 H5 O
  70. dma_addr_t dmaphysdest1 = 0;
    , @4 n+ d7 i8 F) i- i
  71. dma_addr_t dmaphysdest2 = 0;) _% a" d4 {- y4 W, i1 I

  72. ( b* Q1 d1 R# K
  73. char *dmabufsrc1 = NULL;# c; v( I9 w9 {1 R
  74. char *dmabufsrc2 = NULL;; C/ e/ F; h4 F/ i
  75. char *dmabufdest1 = NULL;$ L* T  Q+ _9 X6 ^1 k& \
  76. char *dmabufdest2 = NULL;
    , M1 c( q; C! Z
  77. & B+ _  p7 j: F# Z* a
  78. static int acnt = 512;# A! ~" [5 i( j, b
  79. static int bcnt = 8;
    . b. [$ d, `- J- g5 b& ^& L6 b3 u
  80. static int ccnt = 8;
    : E, i9 ~1 l9 f& _1 t

  81. & O3 A' l; ~/ @6 q; e
  82. module_param(acnt, int, S_IRUGO);; }/ o$ }9 W8 r5 J) Z
  83. module_param(bcnt, int, S_IRUGO);
    5 B. A% _# p. K# ?* K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) @5 @2 p- b- [# G. b# c# ~: u- l- z1 I, \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) o* }3 V2 E# m$ [0 c* K1 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" n3 Y5 H6 P; k2 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* s6 U# V2 h) `9 U7 `: N8 M3 a
3 ?9 i0 f' r( G8 p" j  {8 O) O1 H% j

6 T' U& h: J/ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-11 16:39 , Processed in 0.039940 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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