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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* b! P4 Y; I) U4 J$ i7 W3 R; b
  1. [code]EDMA sample test application
    1 N8 x8 ~1 v" f. C
  2. /*
    , N* Z1 V7 `4 Z% ^2 I# {0 ]
  3. * edma_test.c% X2 i- x- P% {# E7 C1 D
  4. *$ K' S: y3 @  Q. a# Y
  5. * brief  EDMA3 Test Application& C: R3 `" u- S7 R! W
  6. *% V: _9 {+ r1 |5 F2 z
  7. *   This file contains EDMA3 Test code.
    / N  Q' I% ]4 E, S5 A
  8. *& u! i- Z: E" r3 g7 E4 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 i: O7 Z% V6 ~, f$ A, W, }- C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 K7 G, L% x/ e* L& ^7 g
  11. *         TO CHANGE.
    5 D7 ]( S' `8 w) l. x  K( C
  12. *6 A0 T1 [" {% j6 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 P1 [+ A* a! R# s' O0 d
  14. *5 y; X8 f7 v  D2 t# O1 E
  15. * This program is free software; you can redistribute it and/or- M1 O  O. a: D$ A
  16. * modify it under the terms of the GNU General Public License as
    ; {; g) c+ u4 i
  17. * published by the Free Software Foundation version 2.# F! y6 ?5 l. x3 P" y( T+ T
  18. *5 f4 r% ^0 G. o+ e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. v6 k+ Y8 F/ q% z  P
  20. * kind, whether express or implied; without even the implied warranty
    + p6 s7 ]  }( H3 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 K8 l& u% b9 q8 U0 g- R  C$ h; T+ i
  22. * GNU General Public License for more details.
    - o+ w( S: \: r! x7 f
  23. */% _$ c, ^2 X3 M  |' G% H0 q
  24. 7 @! U+ }! S, O# X
  25. #include <linux/module.h>
    ) d0 e3 c7 B; ~
  26. #include <linux/init.h>
    " W" {% v* b9 x' M" t+ {
  27. #include <linux/errno.h>% S/ V+ [6 H% B  G. C' x# a7 I
  28. #include <linux/types.h>
    6 t5 z! H9 @& }7 d% |
  29. #include <linux/interrupt.h>3 u* K% v* K, f- H" q) }4 a
  30. #include <asm/io.h>1 Q$ \+ ?0 c2 B' Q% X3 A
  31. #include <linux/moduleparam.h>! h$ P/ }) r# u6 [
  32. #include <linux/sysctl.h>+ }1 g+ W! H  U; B
  33. #include <linux/mm.h>6 }8 f0 I( U3 P: \' R
  34. #include <linux/dma-mapping.h>
    4 ^" o/ h% c0 e: c0 l* g) f

  35. 7 u0 f7 o0 n( L% F, L+ m, t
  36. #include <mach/memory.h>7 r2 C( E) y  e) n
  37. #include <mach/hardware.h>
    , L( k9 @: H8 n/ ~8 j: D$ {
  38. #include <mach/irqs.h>7 k0 K, |" I8 c, l
  39. #include <asm/hardware/edma.h>: E3 A0 B$ E# y8 E. C7 \
  40. , @& r! \1 q$ N# o
  41. #undef EDMA3_DEBUG6 P2 ?( @1 Q* w% e
  42. /*#define EDMA3_DEBUG*/
    2 t! n5 \" ]9 j5 N* I  N$ s

  43. : ~4 U0 O, N2 F3 ]; k  k2 N
  44. #ifdef EDMA3_DEBUG
    7 ?+ t2 \8 T# Z  [7 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " O' c2 R- X. F8 Z1 Y; a- q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _) S$ R2 V$ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 ^; \# m7 N; z
  48. #else7 W; N- j4 g3 y  g
  49. #define DMA_PRINTK( x... )
    . i- C' B9 j1 Z: ~
  50. #define DMA_FN_IN
    ( \- b6 P2 @. {* F2 q, C8 ^5 F
  51. #define DMA_FN_OUT7 ~# I" B. H9 B0 Q
  52. #endif# _- N/ B  t2 E# S. E
  53. * H# C. Y; D# ~" d8 O8 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . R3 p9 d& t- k7 e& H1 |
  55. #define STATIC_SHIFT                3
    2 l1 ?5 P" D! C! e5 S
  56. #define TCINTEN_SHIFT               202 d2 f: [: q' h6 `& y6 \
  57. #define ITCINTEN_SHIFT              21
    8 c. f! N' f5 i* ~
  58. #define TCCHEN_SHIFT                22
    0 E8 ]' o/ @' b3 C  a+ u6 L& Z6 @
  59. #define ITCCHEN_SHIFT               23
    + L8 K3 Q  j, e5 s& Q$ [2 {! }

  60. ; K: U4 P& A  h7 I
  61. static volatile int irqraised1 = 0;9 v) M6 m1 W) q* Q9 `: c( j. @5 d
  62. static volatile int irqraised2 = 0;
    6 q0 [- F4 \4 z6 H$ z
  63. + H8 x" V) h( F" x5 C2 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H$ B* R7 s. u) l) t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( I, O0 L* ~6 A/ ~0 b) x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 y1 b! K8 P' }1 x6 ~) m/ i
  67. . N3 ^: V: w; ^/ F6 p
  68. dma_addr_t dmaphyssrc1 = 0;
    7 m' a6 G0 V: `0 N) c- I( z
  69. dma_addr_t dmaphyssrc2 = 0;
    & W) F  \8 K" c, k0 b! o/ f2 X
  70. dma_addr_t dmaphysdest1 = 0;
    ) X4 _- v' p* a
  71. dma_addr_t dmaphysdest2 = 0;
    8 c' H! C9 r  u* }7 b: i6 h) @
  72. ( p0 j! s# J- J6 h6 v- V( n. g! ]* q
  73. char *dmabufsrc1 = NULL;$ h6 I: _. Z7 |" ?# ]+ @: M+ s
  74. char *dmabufsrc2 = NULL;5 f/ \: p- o: ]( C6 S
  75. char *dmabufdest1 = NULL;- v/ E- b$ D8 M' J
  76. char *dmabufdest2 = NULL;
    7 S+ U. ^  R, J9 l, S

  77. - M7 D9 k5 w- C
  78. static int acnt = 512;
    ; e( z: G. u3 V$ W9 z- c0 l6 R
  79. static int bcnt = 8;: R6 X+ [' W+ w* }) z& b% v
  80. static int ccnt = 8;2 s3 G& s- I0 K4 W- b4 @/ q# l
  81. 5 Z. a% h0 r9 n
  82. module_param(acnt, int, S_IRUGO);
    . q9 s: U, \, _5 j
  83. module_param(bcnt, int, S_IRUGO);& \3 [/ v! Q0 u- K* S7 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! ^( t0 p% f2 `4 t) k$ w. N
) w3 s% x6 @2 X1 p8 i& |6 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! U! L  ]0 b3 N+ g- M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 C9 @4 l1 J. Y! b1 u* P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 i6 E: A( T: ?! @( H2 p" H
4 J1 [+ m+ W; y0 H! b& |2 c& k/ c+ f9 v

# H: b5 e# }' f6 {. e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 21:16 , Processed in 0.044762 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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