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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 q% Z: t$ J1 ~" g/ N
  1. [code]EDMA sample test application2 y- u5 D7 Y  J9 F$ d
  2. /*
    ; I6 Z8 f2 j9 a7 I2 f6 v! b0 E
  3. * edma_test.c
    - c- p; _( J. G2 H" A. ~7 K4 O* U6 W
  4. *
    - p! {1 ^; t/ N4 W8 G2 h/ X
  5. * brief  EDMA3 Test Application
    $ G- d% N: k3 @! j) z) }$ \
  6. *5 n& Z0 _& C! z9 j- h% v
  7. *   This file contains EDMA3 Test code.1 R6 T7 k/ I' _( s6 C0 z
  8. *
    . e- w7 ~" L) {/ f9 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( B/ z2 U; I" W8 J: f$ e: w! @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 j4 Q0 X' p+ }" l
  11. *         TO CHANGE.
    2 N2 l  b! @5 ]8 x& S2 X
  12. *9 p. k, V& s$ h5 l" t* \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// b* x2 q, A% W, s2 ?) c% M1 W
  14. *
    # s3 c  h1 N1 S8 n5 b% O' l) q4 A
  15. * This program is free software; you can redistribute it and/or6 v  i: e) E5 X. Y0 [
  16. * modify it under the terms of the GNU General Public License as
    6 K# m( |0 w' [
  17. * published by the Free Software Foundation version 2.$ R* U0 s6 `5 F5 l+ i
  18. *  e" a# R& |: F( l; `1 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 ^  C+ F5 U. s; A! y4 H; z* Q
  20. * kind, whether express or implied; without even the implied warranty
    : D7 R( T7 s. H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" H, d- h. w& c2 A( K+ G
  22. * GNU General Public License for more details.
    & b' P  C8 z' i1 R6 i4 c
  23. */- y8 [1 e( D) J: V8 f
  24. 5 o6 _$ ~4 t' i" [7 @* D+ V
  25. #include <linux/module.h># a3 v4 b% ^( b% @5 j8 x7 N5 p  i
  26. #include <linux/init.h>( b5 B' e( A" a# }
  27. #include <linux/errno.h>
    3 H) @+ {/ v: a5 e1 X4 R8 c  k
  28. #include <linux/types.h>
    * V3 Y) m' z' F& G# @9 ]  D3 Q
  29. #include <linux/interrupt.h>
    2 O, q8 ?9 @! c$ J, `  j
  30. #include <asm/io.h># a* ^( n- C6 l' n
  31. #include <linux/moduleparam.h>) n7 n1 U: ]) B$ s7 g- k& r$ K
  32. #include <linux/sysctl.h>
    ; c& |9 z6 Z% J# w0 z
  33. #include <linux/mm.h>
    : t0 p5 K( X8 _$ v3 {" ^
  34. #include <linux/dma-mapping.h>
    6 g; \5 }; G% W  Q7 n' F& p; u

  35. % [: {# A0 u- g0 t, c1 _
  36. #include <mach/memory.h>7 p4 ^; g- N& b' v/ b- H" _
  37. #include <mach/hardware.h>
    & n  X9 j( I$ e: N* U% ^
  38. #include <mach/irqs.h>  L3 H7 A5 h2 l
  39. #include <asm/hardware/edma.h>
    ( Z& S7 Y1 n4 K# ~
  40. & c- t9 P, N; y
  41. #undef EDMA3_DEBUG
    ) p& ~& `/ J" q1 ]7 u! u6 S% W9 Q
  42. /*#define EDMA3_DEBUG*/
    $ s6 |3 n  F+ F
  43. ; H: M9 j- u* i2 t# S2 v  q
  44. #ifdef EDMA3_DEBUG/ X3 B* H* s; n6 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      f: B& x' X) J( o1 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 e/ m. O3 e. @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 F: {( `$ y2 v1 z( k8 h
  48. #else8 J/ F. k- ~% o6 m- T  g; D
  49. #define DMA_PRINTK( x... )
    ! @$ c) E. Y- X, z9 `3 p1 t
  50. #define DMA_FN_IN
    * o1 R/ Y% v) v( K* I# y
  51. #define DMA_FN_OUT; T  x5 S5 M4 \6 {( ?0 E
  52. #endif
    / _( }4 m8 \, P+ b

  53. * j4 a2 a) t& B' {# R. Q4 @( a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , A; n% [& P9 z! }" p2 d
  55. #define STATIC_SHIFT                33 g- u7 D6 o. D0 Q& I& a* v" a
  56. #define TCINTEN_SHIFT               20
      n6 m8 d* {: b+ B) @" m
  57. #define ITCINTEN_SHIFT              21
      c1 P& Q* V) l
  58. #define TCCHEN_SHIFT                222 k3 g' [# _* n- O) r& w6 L8 b# p
  59. #define ITCCHEN_SHIFT               232 s8 F/ k. X. ]$ i' y

  60. 9 U8 U8 j* h8 j( e/ a
  61. static volatile int irqraised1 = 0;0 }# o* I+ s$ B+ V
  62. static volatile int irqraised2 = 0;
    7 A6 f  d. }+ j( ]) D3 {9 c- T' ?

  63. # V/ s2 L  Z) d5 Q/ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; E' d0 h+ c/ z3 p8 Y$ K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - P' Z; D4 B& I! X3 b% D& ^  t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 e) @6 N+ [4 y

  67. 5 u) s9 O5 T, i: J$ |
  68. dma_addr_t dmaphyssrc1 = 0;
    4 Y3 e- g5 y# S
  69. dma_addr_t dmaphyssrc2 = 0;
    7 [/ p: J5 K  P& S; S/ L2 E& k& o
  70. dma_addr_t dmaphysdest1 = 0;
    , e, }0 M  y4 r
  71. dma_addr_t dmaphysdest2 = 0;: S* C$ h7 f8 W# Q; T) p

  72. # A( v) d4 ^3 a6 ]7 K" A3 r* W
  73. char *dmabufsrc1 = NULL;  g& D$ c/ Z( T' P
  74. char *dmabufsrc2 = NULL;
    * h, v* v+ J6 r; ]
  75. char *dmabufdest1 = NULL;2 N4 F. e3 I( f. A$ K, `: X
  76. char *dmabufdest2 = NULL;
    0 E$ _8 J( P+ j
  77. * y4 q% h( ]* b; N' L
  78. static int acnt = 512;3 S2 R- A$ w- {: _- ^' [6 v2 B
  79. static int bcnt = 8;
    9 C# {: g" }. e6 Z7 T- q# D
  80. static int ccnt = 8;2 O7 i. Z3 i+ g% t' ]! Y; F# t; ?
  81. " c9 ~1 u4 ?. m8 Y( m3 z4 q
  82. module_param(acnt, int, S_IRUGO);
    3 }0 r# `* ~" k$ a2 B  I' R
  83. module_param(bcnt, int, S_IRUGO);. E& b! G' ~. e5 g; ]% X: d  |: A7 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% N% j* o( K! |' H- H. x8 e' @' N( E  N! L* o1 e# \+ j% v  l- m4 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# A: n) n" V2 j  Y3 e) B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 X/ w$ ~: O" x7 P8 t6 i3 `9 D! J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 P1 v8 d: l; w# Z% O2 F0 {# f# K6 X! L8 ~) L+ X5 V

8 V6 j/ ?: `4 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 23:59 , Processed in 0.043506 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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