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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # S( y$ l5 H6 O& e6 i* T$ ?
  1. [code]EDMA sample test application
    # F* K+ N0 }1 w; R4 Z$ d
  2. /*. b  ]4 @# |1 n7 d" M
  3. * edma_test.c
    , X  w$ F2 `; z6 s; m
  4. *& {4 t. g* F1 j  `* U
  5. * brief  EDMA3 Test Application
    ) Q% m4 }! }5 [, z$ R: q7 _1 V7 I
  6. *  x$ X' c1 L5 A6 h0 M+ ?" J( T" b) w
  7. *   This file contains EDMA3 Test code.
    & V+ M" K9 Z) ~. n0 m3 `3 G; ~
  8. *
    5 U; f: I4 d6 X0 b2 |# S5 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; A' A% h6 j7 C8 w7 G) ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 A) H% q. _3 A  O' V, {# K
  11. *         TO CHANGE.
    8 D4 {% f! d6 `+ X& D5 }
  12. *
    ( ^9 j8 m9 u/ g2 W5 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  }0 ~$ @3 q2 {, Z7 ^# V
  14. *
    ' F. }& }/ M& g
  15. * This program is free software; you can redistribute it and/or- D, F! x/ l. g/ T6 ?- y
  16. * modify it under the terms of the GNU General Public License as
    ! e4 ^3 j0 p$ d# H6 x) b& ?8 H
  17. * published by the Free Software Foundation version 2.
    3 I( y) g% d; o' M2 Q; V; ~
  18. *
      o/ M% k( t, q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % E8 V' t( n4 D! {6 b6 |
  20. * kind, whether express or implied; without even the implied warranty' W" T3 A- ~9 S" F9 G' d9 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 V7 }0 Z2 f- z, h8 B+ ?3 P( S! V
  22. * GNU General Public License for more details.& D$ I8 b* {# {% w& ~9 O6 @! b
  23. */8 s" h9 M' e& |8 T1 h% m' z+ l

  24. 3 ^2 j$ _) `, m; }
  25. #include <linux/module.h>( S1 E( D# W- N  f8 p
  26. #include <linux/init.h>" ?; h/ S3 S/ @
  27. #include <linux/errno.h>
    & q! J7 I5 _$ g9 g& W% M
  28. #include <linux/types.h>
    * z* ]* \  L2 @; j* x% ], f
  29. #include <linux/interrupt.h>
      D/ h" ]7 u* L( t1 O! o  d; e( K
  30. #include <asm/io.h>
    # ]0 u  n/ v' ?  Z, F; b2 F  A
  31. #include <linux/moduleparam.h>
    3 G9 w# ~( @( V
  32. #include <linux/sysctl.h>& L* z* V# y; v5 ]' O
  33. #include <linux/mm.h>3 g" d9 g- ~9 L+ {6 o
  34. #include <linux/dma-mapping.h>
    ) X8 t2 c. Q+ S
  35. ! w: m+ J8 ^- w, s( g" b
  36. #include <mach/memory.h>( l1 b7 t+ L" B# q" t- E7 E
  37. #include <mach/hardware.h>
    , x/ q: f. O  a3 h
  38. #include <mach/irqs.h>* n3 ^8 j: x- u2 U) `
  39. #include <asm/hardware/edma.h>
    , r2 u1 n0 M# Y

  40. / i2 C- V1 J3 e: `4 U# m
  41. #undef EDMA3_DEBUG
    6 o2 z9 K" V  R6 G
  42. /*#define EDMA3_DEBUG*/. ^! S! h4 G- K( T
  43. 2 k' h. z$ ^1 q
  44. #ifdef EDMA3_DEBUG
    & |( r5 n. i( `: m7 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 ^- W8 ]5 }! l3 o- [( T* U6 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 w) `# B3 k# d- k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 i7 ?4 H: m  j" `7 N
  48. #else
    ' z0 d# U: e1 N- D% `; E9 N2 h! B  I
  49. #define DMA_PRINTK( x... )
    " ~  v/ X: M4 U0 j8 E
  50. #define DMA_FN_IN
    4 _. b- e- `# p# i7 Y$ w! c0 d8 \
  51. #define DMA_FN_OUT& p" n" P. d# ]" M6 `3 n6 x
  52. #endif
    + f; t9 z0 X* Z$ h7 b; c. Q0 ~
  53. ( l$ X. G! n& O5 z8 k" _" R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 M- l  T9 n. ~; U5 n
  55. #define STATIC_SHIFT                3( Z! V( l. a# p! s5 T/ V
  56. #define TCINTEN_SHIFT               20) o: g  D. S2 a4 R5 Z
  57. #define ITCINTEN_SHIFT              21
      N$ ~9 z7 _2 f) h; t! P/ M: i
  58. #define TCCHEN_SHIFT                22: S, k" R+ n. H
  59. #define ITCCHEN_SHIFT               23
    5 j+ y( \3 y% O& z! i

  60. 2 D) p: T5 g4 c& C
  61. static volatile int irqraised1 = 0;
    & c6 N" Z$ N+ K7 T& L
  62. static volatile int irqraised2 = 0;
    4 S3 I4 a3 m0 M; A$ v% f

  63.   ~/ r5 _. r, M' V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 L4 X/ Y" A4 B$ C1 \4 J: Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% y  ]0 ^7 ~2 F; P4 Z1 P+ e9 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * d; i+ ]) l  `# _4 {

  67. # Y7 Y9 H5 K& P9 l) W
  68. dma_addr_t dmaphyssrc1 = 0;4 O% v; ^( W" C6 R3 S
  69. dma_addr_t dmaphyssrc2 = 0;
    * ]! R" T. B( e# e1 m1 u; a
  70. dma_addr_t dmaphysdest1 = 0;
    0 ?: o0 @9 @! ?% d4 e2 J
  71. dma_addr_t dmaphysdest2 = 0;
    8 ]* r) G+ n9 [: A& z/ r  n+ A

  72. - b% Q6 G3 L7 N. i* Q2 b% {  Z
  73. char *dmabufsrc1 = NULL;
    * Q! _3 W% @1 \! S
  74. char *dmabufsrc2 = NULL;4 Z$ [! z- y4 Z
  75. char *dmabufdest1 = NULL;
    ( i$ e( h5 R4 w
  76. char *dmabufdest2 = NULL;
    & F4 \3 c+ m6 I3 @4 ~$ L  n& e
  77. ; h) s+ H; `' h6 i
  78. static int acnt = 512;
    : w1 b7 K) x( P. f9 q+ a3 ^) [7 I
  79. static int bcnt = 8;9 [9 ]4 K& J& N
  80. static int ccnt = 8;
    4 z; _* k; _+ W
  81. 4 V6 e2 O& k- U  v3 V- g
  82. module_param(acnt, int, S_IRUGO);/ x% {2 H7 Q' A( D1 h, q
  83. module_param(bcnt, int, S_IRUGO);8 T. |- J8 L8 B: Z6 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( b% W& q" n: y' A# U' y5 l! `7 [+ ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- r" C0 t* P$ ^# Q/ z6 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 \3 O  Y% @) d3 I9 S. c9 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 h) C5 v3 G' |: K/ e

; A  G- ]& E4 ^% c% f) l
3 p! q1 ^1 r, f+ E# o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 01:26 , Processed in 0.039797 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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