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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 [9 [; Q4 P) O7 y
  1. [code]EDMA sample test application. O4 Q# R; X3 E) M  k9 z- c
  2. /*9 l0 V: L' h( s% y9 D4 V3 q
  3. * edma_test.c
    : H( q0 h7 W: O4 y: V. s* E
  4. *
    1 K$ N" B7 ^1 S
  5. * brief  EDMA3 Test Application
    3 B1 v$ M, z; s$ A( n
  6. *
    # E$ t6 [* z; {1 c
  7. *   This file contains EDMA3 Test code.. A' A* a9 r9 G+ ~8 H
  8. *
    . Q& R1 x7 w- E' y7 Q! r; G( Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( B7 P$ H2 u2 {* v2 j0 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& j; V: S  w5 b0 x# w! J) S; e. ]
  11. *         TO CHANGE./ B1 t  O3 ?$ @, \( D4 Q
  12. *) }6 s4 |5 d: d( }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ g% V$ q/ Y: V2 Q: |9 s/ _
  14. ** N' e9 Y& l  J9 Z' f  c/ b
  15. * This program is free software; you can redistribute it and/or/ b- @) E& h, G' i2 |$ F
  16. * modify it under the terms of the GNU General Public License as
    * W+ p( n! \" |  R
  17. * published by the Free Software Foundation version 2.8 F. f6 q' G7 K4 I
  18. *8 k5 `' ~: \/ G! {: i* a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      D% [/ j: g$ F- A3 t6 n4 l/ c- }! e
  20. * kind, whether express or implied; without even the implied warranty
    ; q" W# |- K1 O- t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" x. D( A& U% s  _- B- r% D
  22. * GNU General Public License for more details.' Z' E: k0 l: U  E
  23. */
    3 f* T3 L, l* }2 c* q$ a! r/ S2 c

  24. 8 |* K9 q3 a0 B: v) B
  25. #include <linux/module.h>
    / N% T- T0 \7 d
  26. #include <linux/init.h>4 x3 d0 Z2 R, I  P
  27. #include <linux/errno.h>
    0 r! w" Q% R, x" ?+ r8 u
  28. #include <linux/types.h>
    " a6 K! W9 \/ v
  29. #include <linux/interrupt.h>4 j* k, U; }" n# u
  30. #include <asm/io.h>
    " _# N& h' k5 P& ~9 @# j, W
  31. #include <linux/moduleparam.h>
    $ F" U, s* S- T9 l1 O+ M! H
  32. #include <linux/sysctl.h>
    , p8 v9 V, F1 |/ ^9 x; {
  33. #include <linux/mm.h>
    # Z' R$ k& b) ?/ c
  34. #include <linux/dma-mapping.h>
    7 p1 ?- S4 ^8 @: X' D
  35. % |/ o4 z8 j* b! a
  36. #include <mach/memory.h>' w, ^1 G1 i0 c0 d3 V9 I0 i9 {
  37. #include <mach/hardware.h>! Y4 h9 X8 N. K) N' R& ]) ?. N
  38. #include <mach/irqs.h>) ~% b: R; S4 w9 C2 W# P/ D2 i
  39. #include <asm/hardware/edma.h>8 L1 A0 a; c- r' K& s$ R  j. y; h
  40. 0 L9 e, j1 l/ v5 l
  41. #undef EDMA3_DEBUG
    9 C( u- Q' D, s! Y
  42. /*#define EDMA3_DEBUG*/, ?; V* m/ |. H" c* v
  43. " M! g6 U4 {- ^" W
  44. #ifdef EDMA3_DEBUG5 ?- g7 {3 R" x% f: d; z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- I5 V7 ^( q% y3 ^1 v& o% c$ _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " y5 f+ Y4 y; C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  G# u: E2 g. \% @
  48. #else
    ' f3 P5 h, w5 M4 F( w+ x% s0 t
  49. #define DMA_PRINTK( x... )
    ( L$ n$ T0 n) |) p. v
  50. #define DMA_FN_IN! ~# h: k; C" b6 ]& N# [
  51. #define DMA_FN_OUT
    : E0 \4 ]7 p  @. u, }! K& T
  52. #endif  u: E# q5 ^7 f; e. |
  53. 1 @6 u0 y7 b8 ^3 t: v6 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - ?- B) S6 T8 h% J1 w% B
  55. #define STATIC_SHIFT                36 O# M5 I5 E1 D, d: d/ C2 Y6 T
  56. #define TCINTEN_SHIFT               20/ X7 K6 A7 R) |' B, D
  57. #define ITCINTEN_SHIFT              21! o) _) d/ x% o2 p* ~
  58. #define TCCHEN_SHIFT                22' I  |3 s" u/ |9 e) a
  59. #define ITCCHEN_SHIFT               23: ^- e% I$ W1 Y  E

  60. " T0 }6 ~1 K8 h5 [
  61. static volatile int irqraised1 = 0;8 {  ]: y! f, z: d' x
  62. static volatile int irqraised2 = 0;
    5 V* w6 f& D3 b+ B' {9 \* r
  63. 0 h" B( m/ Z: Y& z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # {; V7 L0 `1 n1 f+ @$ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \( U% `, X/ _& J% K, c6 K2 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {4 l1 h  `3 s) A" k/ r1 i1 x
  67. . u* F- }7 N! v' n  p2 U3 ^3 p
  68. dma_addr_t dmaphyssrc1 = 0;
    7 B7 `; j& \" l2 y8 A) R
  69. dma_addr_t dmaphyssrc2 = 0;. J- h4 J3 t9 ^' d2 v$ M+ i( U$ S
  70. dma_addr_t dmaphysdest1 = 0;# D) o& c( B+ x; x( U. I; Y; q' X
  71. dma_addr_t dmaphysdest2 = 0;. d7 C0 t, `! a. ^6 w
  72. 5 ?0 p# _: K! m/ V4 b$ J, A- b& d2 @
  73. char *dmabufsrc1 = NULL;, M3 S/ I" }- v, f, ^
  74. char *dmabufsrc2 = NULL;
    * \/ c$ h+ Z9 I) C5 R
  75. char *dmabufdest1 = NULL;6 L3 ], b( U. d: q0 w
  76. char *dmabufdest2 = NULL;1 I; ^0 R, E& K" u  m
  77. ) j, u" Q3 ?5 ]0 b: o! v3 O2 F
  78. static int acnt = 512;
    8 F! k* C6 K( n4 t
  79. static int bcnt = 8;
    ' i" F/ k( n  a' {' O8 i% N* d
  80. static int ccnt = 8;
    / a$ P3 a1 `: u0 d
  81. 7 w" Z; P# C2 t7 R  l8 y3 T. `
  82. module_param(acnt, int, S_IRUGO);
    4 Z& z# r- b+ B8 N. T) b0 }
  83. module_param(bcnt, int, S_IRUGO);0 T/ o+ z4 t# u2 n1 w! x6 p2 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ K+ Z8 c0 z5 `$ ]& w% f  G0 K! Y$ R. U. H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ l; B, {( b) x2 V  a, V9 l: ]! z6 q# h3 M! Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* E, N3 k( M7 P5 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ]: G% b; e, J9 d& V8 s
% A2 T2 Z$ J& V7 x+ |  [- |
1 c$ ]* t) {- F6 n# a4 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 08:54 , Processed in 0.038144 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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