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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L2 G& a6 p4 K4 d$ \5 r
  1. [code]EDMA sample test application
    9 F' W; i5 \' P4 I2 ^
  2. /*6 w  a8 ^% a# R9 z$ v$ {. z8 L
  3. * edma_test.c
    + P) O- X& \2 e( j$ |
  4. *
    5 m& E1 S* C( P5 y; o$ F8 B4 y) f' y
  5. * brief  EDMA3 Test Application
    2 p) E4 E) m" [0 t! }% i; Q
  6. *
    5 w- Z& p% h8 A7 l% |
  7. *   This file contains EDMA3 Test code.% j; W! i& U9 V* L7 d0 H
  8. *
    0 W9 `* s' F+ u" E- \3 x/ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . B4 T6 h, e- `3 i  g8 @7 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , k% d0 ^9 j/ }, g3 K
  11. *         TO CHANGE.
    ( R3 D( E% _1 o: [$ f
  12. *
    5 C- H& M1 _5 d/ n- q5 }! a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' p- d7 a) @" o' K& v/ i
  14. *
    $ X3 d- C; C7 c4 u* V3 B
  15. * This program is free software; you can redistribute it and/or: l8 z+ d" t$ T* _8 o' t
  16. * modify it under the terms of the GNU General Public License as+ e  Q5 n7 H; L7 Z/ J
  17. * published by the Free Software Foundation version 2.
    ) ?5 Y, o! L8 q7 a
  18. *4 ]7 W0 M  V* X  x- J: J6 P- h  F( @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, z0 ^* @# f( F# N
  20. * kind, whether express or implied; without even the implied warranty
    2 ]6 c3 @6 d" _; w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" N1 V% H0 q' [( l# H8 a, a
  22. * GNU General Public License for more details.
    1 _. c9 d/ }3 [3 N" @& e( a2 s
  23. */( `- h* D$ y1 y* p1 X: ?* _
  24. # V6 @  N9 l% \) A" h3 S
  25. #include <linux/module.h>( T- x9 ]# K; o9 {# x
  26. #include <linux/init.h>; ^- ]3 ^3 O: r" i. |( D
  27. #include <linux/errno.h>+ o3 u; d( g1 T4 u6 S$ y
  28. #include <linux/types.h>
    + b" P  N8 X2 Z) @
  29. #include <linux/interrupt.h>
    % C5 U. A  X! V1 i& c; [. d
  30. #include <asm/io.h># D9 k: D- @/ p& O! }
  31. #include <linux/moduleparam.h># n2 W' g8 R  F4 V7 Y% a# x
  32. #include <linux/sysctl.h>- X% H/ `( ?2 l3 @+ \9 d
  33. #include <linux/mm.h>
    3 a% Z: V) U; {  D- F
  34. #include <linux/dma-mapping.h>
      l8 h% R( E! ^4 m" d  b
  35. - A' V4 w# V. X3 ~% s- F! Z
  36. #include <mach/memory.h>. i1 P8 E) V. T% z2 M/ Z& d  U
  37. #include <mach/hardware.h>
    + _5 q* x: O6 a: d8 p1 e3 t' V# g
  38. #include <mach/irqs.h>
    & I  h$ ~5 K/ t" j, d( z7 H& m  s
  39. #include <asm/hardware/edma.h>
    7 h3 ^' J' S9 ~
  40. 6 E% G5 n/ y7 O
  41. #undef EDMA3_DEBUG
    : ?8 w, t) h+ J% U) D/ @% X
  42. /*#define EDMA3_DEBUG*/! n; p! {: M6 k7 X: [
  43. 2 u) f- W2 h9 h( k; T* \- \
  44. #ifdef EDMA3_DEBUG6 z% E+ V! M8 k; Q8 D4 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( B) z; t  F0 M: [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ v' S& W: j, E8 k% B, m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' \3 @- n  f, B
  48. #else
    3 J+ |& o7 W+ i, ]' g
  49. #define DMA_PRINTK( x... )
    , q& Y& B& J3 ^- f& l+ `( T- j! P9 c
  50. #define DMA_FN_IN1 S0 O- l5 @* W. E% f/ V2 X
  51. #define DMA_FN_OUT$ t$ b. E) Z: H9 T! ?0 ]+ ^
  52. #endif. M( G( b. e9 v8 h0 I
  53. " |7 u8 W# Z( M3 n! M# x  B9 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), g: W3 y8 I9 b& H# [
  55. #define STATIC_SHIFT                3; r) }, R( d0 T7 [8 u4 a' F
  56. #define TCINTEN_SHIFT               208 J( r7 n8 A% C5 X; `
  57. #define ITCINTEN_SHIFT              21
    9 ^% d6 d* h0 t( ]4 H0 R0 v# V
  58. #define TCCHEN_SHIFT                22" b' o/ M4 S. x) x/ `5 M: a3 I4 s
  59. #define ITCCHEN_SHIFT               23- U# `: S* J" Q: z; x

  60. / n% [. j# V3 k
  61. static volatile int irqraised1 = 0;
    2 ]2 E* H* D; e& P+ w9 R
  62. static volatile int irqraised2 = 0;1 q6 O6 W: v) T) l1 d' @
  63. 1 S1 n4 r' e9 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \6 [! c( J* U. W) r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ K+ N' c/ S5 j: U' T7 \* d- q2 M) {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p: F3 l  t6 b  D3 X

  67. $ H* i; a5 Z5 S- [9 m
  68. dma_addr_t dmaphyssrc1 = 0;, v4 }5 r& X! D& ?  }* E
  69. dma_addr_t dmaphyssrc2 = 0;/ Y0 w) t" k/ E/ D  i. F1 E% @
  70. dma_addr_t dmaphysdest1 = 0;  \8 J& i6 T, i8 n
  71. dma_addr_t dmaphysdest2 = 0;' V6 U* n  U) f- @8 m) v" t. j- r' m

  72. ( B4 b0 u* t6 p$ I) O7 W  l/ l! N2 E
  73. char *dmabufsrc1 = NULL;
    , W3 A3 Y6 k6 x
  74. char *dmabufsrc2 = NULL;8 ^1 Z) m0 Z$ C$ n/ a( S, {
  75. char *dmabufdest1 = NULL;1 o6 x. w3 D1 [/ N4 ]/ r7 ?9 y
  76. char *dmabufdest2 = NULL;
    / u! Y$ I6 h0 {- c1 P* {

  77. ' D, c9 O- ^5 p. C3 [  C
  78. static int acnt = 512;
    - y/ d9 b$ D0 I- Z! J$ G0 S
  79. static int bcnt = 8;
    ) m, L% O) [3 T+ {
  80. static int ccnt = 8;) {. N& w' w) O+ x) F' ]+ b$ }! X
  81. & Y- g1 X6 N4 C2 m( A. l
  82. module_param(acnt, int, S_IRUGO);* G! q) f8 d7 n( [& v
  83. module_param(bcnt, int, S_IRUGO);% E8 f  p" s5 k# F; J, b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: O7 O, d0 \: g; H
* @5 I4 x4 _* f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 N* f4 M- X: j) M3 n. \, z/ m' s  z8 j! ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ d9 |! @: {4 ], ^+ _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. z8 ~& Z6 @% n
$ Z4 W3 n: P2 I3 I

5 c0 u2 |  e2 M6 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 09:04 , Processed in 0.039910 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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