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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% v' u4 E4 S2 b# [) w! o4 @
  1. [code]EDMA sample test application
    3 i% Q" ^6 Y6 c+ c4 W$ b) P
  2. /*
    , z  h/ r1 H# q! E
  3. * edma_test.c1 D( Q# S9 \6 @$ b  ~6 k6 b0 w* `4 x
  4. *
    0 Q0 }: A" a9 K3 C
  5. * brief  EDMA3 Test Application( |" F: ]* Y/ w5 T
  6. *
    5 V: t/ R4 x6 Y+ |- [/ \8 X9 M$ A3 m
  7. *   This file contains EDMA3 Test code.- L9 P. ]2 D3 s' f6 m$ U( d$ q
  8. *
    , n2 O: v( z& x- r- p- D. `) X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 D9 m" h* J7 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / w) R, H6 s$ s0 }
  11. *         TO CHANGE.: S1 O+ e# N+ W, {
  12. *9 M6 c; X) q! V1 x$ K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 _7 p) i+ Y9 j& N. M. ~
  14. *
    * a7 T! F/ M5 {5 Y: f( _+ I
  15. * This program is free software; you can redistribute it and/or
    , E- L1 v) L' l. Z8 ^
  16. * modify it under the terms of the GNU General Public License as
    4 S7 Q$ e# E' x( x1 K8 I6 p4 t
  17. * published by the Free Software Foundation version 2.4 ^2 G* w/ C- ?% X
  18. *# i  L) r. X+ S9 Y4 e# E" h- C9 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - P0 X& ~2 A/ N. {- f9 p( F
  20. * kind, whether express or implied; without even the implied warranty" x3 X6 H' V3 r2 ]) f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " _% X2 y* ?, e+ C- S
  22. * GNU General Public License for more details.# t. C" q, _7 ?, \7 H
  23. */
    - |, v3 x5 o# ]5 I0 r3 G( S

  24. 6 `8 J! ], f, Z+ C5 u, F
  25. #include <linux/module.h>7 c% y( a- {- U& _! f9 @/ [: f/ L
  26. #include <linux/init.h>% ?8 {4 g3 b2 p8 w0 @& P9 h
  27. #include <linux/errno.h>4 ]1 _) b: y# M+ S3 M/ ]7 x8 B/ C8 }
  28. #include <linux/types.h>
      K9 E9 v+ Q, [' c# o& \, ~2 z# t
  29. #include <linux/interrupt.h>8 B/ h4 L! ^/ }. h+ C
  30. #include <asm/io.h>
    ; n1 u5 T2 n4 T2 i) X2 {
  31. #include <linux/moduleparam.h>
      T9 [2 n: R5 a1 Z* C- D1 K
  32. #include <linux/sysctl.h>/ z4 o" n# w2 j' k$ c( E
  33. #include <linux/mm.h>
    / @7 H) ]; O4 d) V! a* f
  34. #include <linux/dma-mapping.h>
    * @( t, d0 }8 G+ Z+ G5 Q
  35. " ~5 Q$ ^9 l% w0 w; [& J
  36. #include <mach/memory.h># F5 Q5 U: |9 @1 ^9 w& [; n" O" N7 ~7 `
  37. #include <mach/hardware.h>  W; p! P# f* M3 p$ S& E9 o
  38. #include <mach/irqs.h>* m/ b' o3 H% U0 Q" u
  39. #include <asm/hardware/edma.h>  R  B# f0 E2 x
  40. . o9 o/ l0 E$ N! ]6 U
  41. #undef EDMA3_DEBUG
    ) R5 N( M& m7 t% B
  42. /*#define EDMA3_DEBUG*/  T" j8 g* ^8 K. K1 u- U2 H/ q. u1 Z

  43. - _3 ~& x% Q2 t# O3 V$ E
  44. #ifdef EDMA3_DEBUG
    8 f- y" x- W" q. Z1 y+ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 i4 f2 D, P6 s) y! [+ t" ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) R- ~* {4 U9 X4 j( w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x. a3 t! p: q: V" c; Z( [4 z
  48. #else
    4 X3 M# ^' J+ H, _
  49. #define DMA_PRINTK( x... )
    3 o" x+ A/ }! K' G" d9 W5 E! s
  50. #define DMA_FN_IN
    7 }! b, A: I; k. g# }1 g4 \
  51. #define DMA_FN_OUT4 i7 _0 V2 F9 k! ]2 U0 J
  52. #endif/ p( m6 C* H( w3 }

  53. 5 z3 x: A* k( T$ H, u  W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( _2 G* }. R! Z. S; ~; t( d& ^
  55. #define STATIC_SHIFT                3
    ( X. G0 _" N5 Z! }7 R+ V
  56. #define TCINTEN_SHIFT               20# f2 Z3 ?+ f$ V! l2 f
  57. #define ITCINTEN_SHIFT              21- j% J: ]3 L. w8 a4 H  M2 e1 C
  58. #define TCCHEN_SHIFT                22
    " ~5 Q; X  F/ b# u0 r
  59. #define ITCCHEN_SHIFT               23
      q" q1 B/ L+ y, a0 w
  60. # F* b; X  l" W/ n* }
  61. static volatile int irqraised1 = 0;1 v) a6 {4 P0 s
  62. static volatile int irqraised2 = 0;
    ( L8 l  V* A5 ?: ~1 A4 H

  63. 1 T8 f* `4 l9 |0 i7 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d9 [, e, L& ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. K! D' v1 C$ K/ b- T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 j; B/ y* t1 a6 z  n

  67. - R  m, A6 q/ k
  68. dma_addr_t dmaphyssrc1 = 0;3 f; R/ ]8 A' ]5 v  x* l1 H& @
  69. dma_addr_t dmaphyssrc2 = 0;7 P0 u* v, K# H! ?, K. y/ P: X% \: m
  70. dma_addr_t dmaphysdest1 = 0;
    $ x' A( u7 L( p1 s3 c9 L
  71. dma_addr_t dmaphysdest2 = 0;
    5 k# U1 V) d5 C: E8 R

  72. # C: A* F9 A6 t0 C& G
  73. char *dmabufsrc1 = NULL;9 c% T% V6 Q/ _- k* l
  74. char *dmabufsrc2 = NULL;7 i  l% [& T1 ?0 E- f7 I4 i9 ]% R
  75. char *dmabufdest1 = NULL;1 d( @6 v' h+ j; U3 I$ G
  76. char *dmabufdest2 = NULL;
    7 P- Y1 k0 v: ^0 E$ f8 ^8 t! M

  77. 8 D2 q% l) D( g) d7 V: l! i
  78. static int acnt = 512;
    . n* G( F& X, p- S7 _
  79. static int bcnt = 8;& n( A& @8 X  k- V- y' Q% u
  80. static int ccnt = 8;5 Z- l& Q( @- e. \
  81. $ o/ L! Y8 H+ p
  82. module_param(acnt, int, S_IRUGO);
    7 R/ m, _9 D+ G! R  l/ U
  83. module_param(bcnt, int, S_IRUGO);! p) b0 x0 M" L; X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 i7 u7 A6 D1 d5 o( j" `
# p8 P, @3 K. U% l& P3 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; V% W, A+ t, Z9 b: f' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 Z1 J; i6 G) P, X& [' {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) i; d" r( k$ r" @  p9 t8 `& t
$ K. z3 a5 G3 @
& T3 v  Q* x/ w& Z' g7 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-8 11:01 , Processed in 0.040838 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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