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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - s2 z' N5 F6 L7 ~& C& i, Q
  1. [code]EDMA sample test application' _1 B& Q) Z0 \3 ^' R3 p, V
  2. /*
    0 C0 X6 Z. i2 q5 A1 c+ ^
  3. * edma_test.c
    6 U6 u9 E: E. I# L& \8 D
  4. *
    " `7 L/ I1 x' K. O' |7 X
  5. * brief  EDMA3 Test Application
    ; A4 I, o! e- h* z5 Q
  6. *
    : B1 P+ N* w9 k8 Q, {
  7. *   This file contains EDMA3 Test code.
    # Q' {* a' U: e) C" v& F+ K) T& a
  8. *5 E' S+ y9 j6 ~8 {. G/ }8 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ L7 P8 \9 p5 G( t4 a6 Q* b/ Z5 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % x& L7 E) u: t# i2 \! M
  11. *         TO CHANGE.& Q# H9 y1 p& X/ @: h
  12. *
    . P9 ~, X5 F& F4 x+ r6 q6 w1 G: ]! L7 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& z+ ~6 ]% j0 i' x5 Q' t" O" }
  14. *
    1 V, i6 v% {. T7 p7 E
  15. * This program is free software; you can redistribute it and/or- X! F) j; A7 ?3 o! T4 S* ^8 ~
  16. * modify it under the terms of the GNU General Public License as& P- M3 Y) d0 g) G5 K
  17. * published by the Free Software Foundation version 2.3 p8 Y1 P! \' h/ k, w
  18. *
    3 y: C, a& c/ }6 o! c# F% v# P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - Z, V) K+ S* v
  20. * kind, whether express or implied; without even the implied warranty
    ' V1 W# ?# a7 Q1 j7 D7 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 u- l" Z0 _$ L+ m5 [& Y
  22. * GNU General Public License for more details.
    . {' h0 }5 m7 _0 N
  23. */3 _; w  I& v% K1 D% y: G% T
  24.   s: @5 L# o' o( m& w8 j
  25. #include <linux/module.h>
    % }  M5 w8 m! `$ K
  26. #include <linux/init.h>/ d# D/ r) F/ Y: p" h
  27. #include <linux/errno.h>8 S" t5 Y4 q3 r8 ^5 Q' ^# |* {4 |
  28. #include <linux/types.h>
      P& D' p! ~7 f7 o
  29. #include <linux/interrupt.h>1 ]+ r# h! w) a5 ]
  30. #include <asm/io.h>* i2 M7 i2 F8 W3 Y5 {5 F
  31. #include <linux/moduleparam.h>2 D- n: E# a* ?
  32. #include <linux/sysctl.h>
    0 P9 C* w& S# \, ^+ x1 ]- W
  33. #include <linux/mm.h>1 o- M: [) Q' r0 I$ H4 U
  34. #include <linux/dma-mapping.h>, _  [  h7 c9 r- R, Y

  35. ' U& q+ a9 z7 P) b. M, B3 W
  36. #include <mach/memory.h>! U2 y6 F$ b( z: U+ M
  37. #include <mach/hardware.h>0 S( h( ]: N. g9 ~
  38. #include <mach/irqs.h>! h. T7 S5 q$ H% a) E1 w
  39. #include <asm/hardware/edma.h>! f* L9 o$ p8 n# G5 n

  40. . [4 I& d2 g( k/ H! {3 [& r5 L+ ^
  41. #undef EDMA3_DEBUG
    % O0 X/ p4 J1 ?9 K! X0 Z9 ^
  42. /*#define EDMA3_DEBUG*/2 F  E. [8 `" G7 L

  43. ! H& J3 N8 J; ]3 _4 T5 w# K
  44. #ifdef EDMA3_DEBUG0 G. A: v# S) V+ I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 W5 i$ P5 G6 H. `' W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ B8 c8 Z4 K; b0 Y# J* U) X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / j: R1 `2 v1 [
  48. #else! S- q% ~  B/ n$ y6 @8 U
  49. #define DMA_PRINTK( x... )6 h% s' i( G1 w3 Y+ ^' Q
  50. #define DMA_FN_IN
      ^$ P4 H. \1 x+ r
  51. #define DMA_FN_OUT) @, L: c) U9 F2 f* w# a
  52. #endif
    - @/ R, w7 ]) C/ t/ I+ w" p9 m* Y

  53. / e9 ?. v+ U! O0 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 L# `) s* \. y* {
  55. #define STATIC_SHIFT                36 t7 R& _0 {$ e& _. f# C6 y' l
  56. #define TCINTEN_SHIFT               20  _2 X. [( {( p' q$ C- a$ p! B- c
  57. #define ITCINTEN_SHIFT              216 h; ?% t$ j5 z) k1 G% `% @+ |
  58. #define TCCHEN_SHIFT                22
      u  J1 b# N" O
  59. #define ITCCHEN_SHIFT               23
    8 ^. Y' e$ ?+ v( ?  Z4 T
  60. ! E  ?+ s3 H/ ?  r/ {) a
  61. static volatile int irqraised1 = 0;3 ]( ~' C4 J7 ^5 R$ R
  62. static volatile int irqraised2 = 0;
    + P5 |0 W7 g+ c: t4 B- ]
  63.   U% X+ r* X+ p/ G- H( ?- N- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x$ y  Y) Q" D6 i) x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 `" J+ M9 L  @% N7 O) n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 N/ a$ c4 N/ C7 i
  67. . I; C" H8 @/ i& ]6 _; a
  68. dma_addr_t dmaphyssrc1 = 0;
    2 ?- R; g$ r$ C+ @. n: R
  69. dma_addr_t dmaphyssrc2 = 0;  v  ]! ]# s, u) q
  70. dma_addr_t dmaphysdest1 = 0;0 Z$ b7 `# P3 l/ s
  71. dma_addr_t dmaphysdest2 = 0;+ F3 u% R4 m# B% l( K4 q% B
  72. 0 }4 e& W! h& B+ J( ]) L* l
  73. char *dmabufsrc1 = NULL;7 y4 p" P/ M; i/ ~  E) C0 j
  74. char *dmabufsrc2 = NULL;' [& t- l$ {0 }0 K0 G
  75. char *dmabufdest1 = NULL;
    ! b1 t8 C5 r, c1 a4 M3 I
  76. char *dmabufdest2 = NULL;& L$ w2 B+ H  ]5 I

  77. ( _, f2 k# a) B5 T0 D: _
  78. static int acnt = 512;) D0 Y5 d  B3 G7 [  g! O6 z
  79. static int bcnt = 8;2 S- z/ d) g- T8 @) m
  80. static int ccnt = 8;
    0 p! n! Q8 I. g$ v! J

  81. * u. ?# Z5 T5 u4 w
  82. module_param(acnt, int, S_IRUGO);7 {) b! ?  t/ v  ~
  83. module_param(bcnt, int, S_IRUGO);
    ) U% E: F# v0 k- {9 m, {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 R: P* L9 V7 Z# U; w  d3 q
4 O( N3 J8 d' ^/ Z+ V2 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 {) M" Y- U2 R  F: }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ]8 m3 U) b; w' P- @% }" r8 b- ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: c0 A" E4 u  e1 z( Q* ?) _
+ ]7 n* r  W: R# x" U1 e

. C! h% M! g2 z! V4 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 03:27 , Processed in 0.040448 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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