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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & S) \% y1 w1 E: g: M8 P( C+ I
  1. [code]EDMA sample test application
    8 k0 A1 P* A9 X/ I/ Y
  2. /*
    ! D2 h% S8 ^2 ]
  3. * edma_test.c
    ; P; B3 M. u+ g
  4. *  v: |- T( G! F1 l$ n8 g6 E
  5. * brief  EDMA3 Test Application9 k- u5 ~3 V$ `$ _
  6. *
    - K: a8 ?% C% y; r% ]( F
  7. *   This file contains EDMA3 Test code.
    6 O, u9 D3 F: v# a! l9 S
  8. *
    ! E. z0 t9 e- n6 q. y7 f; o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: v; Z" b& {) L" m6 y7 J8 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  @& K1 N+ Y* N, S0 P. r- J# s
  11. *         TO CHANGE.
      ], T, ^/ A! f; j4 E* Q& r
  12. *
    % R" J  K! O1 t. k0 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 L9 d; _! x; e  o
  14. *
    4 a' J2 z" [/ c, s5 X% s
  15. * This program is free software; you can redistribute it and/or; \- [$ f3 N5 k8 @3 u7 e# `5 l/ i
  16. * modify it under the terms of the GNU General Public License as
    ' Z7 i4 P* n1 K9 V# n1 S( B
  17. * published by the Free Software Foundation version 2.; T3 F3 R$ H% Z7 D! c
  18. *
    ' a2 O  t: K. ^3 ]% g7 D1 \* @, _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % l9 L' V% U0 W3 g. o
  20. * kind, whether express or implied; without even the implied warranty
    $ m3 w, N' _" h! V4 ?& L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % I) G" ?% z3 G* T% t. r
  22. * GNU General Public License for more details.
    ( G/ L, W7 Q! P/ m6 \' D& H
  23. */
    / Z3 _# Z! s9 R7 `) P! ]

  24. ; H' R+ u& f  ], B: s
  25. #include <linux/module.h>" e: V) k$ X: r
  26. #include <linux/init.h>
    " ]/ _* h1 K- n% P
  27. #include <linux/errno.h>
    6 p* H% |3 y/ q/ Y) j+ P1 h: o
  28. #include <linux/types.h>
    / u9 [# @! h; Q+ M  I7 T' ?
  29. #include <linux/interrupt.h>
    0 E3 I5 ?- }; |$ F
  30. #include <asm/io.h>2 d3 L  S. Y7 v
  31. #include <linux/moduleparam.h>( }- Q6 |! i7 v9 V8 ^
  32. #include <linux/sysctl.h>
    ( U1 J0 S: K2 o! K- u- M
  33. #include <linux/mm.h>4 O* k/ d3 I9 Y+ l( h
  34. #include <linux/dma-mapping.h>
    " o* R4 |( ?3 x5 i. l4 j

  35. 1 w+ E; C! h: ~. l) b; a
  36. #include <mach/memory.h>
    / e8 [3 Y( o6 @3 n' v/ |
  37. #include <mach/hardware.h># l" v# t, v. q( X+ Q9 m; `/ I
  38. #include <mach/irqs.h>
    5 y! u# V% s% f; p% v1 w4 m( h0 f1 P
  39. #include <asm/hardware/edma.h>5 }5 U& K; ^# E2 u! _

  40. ( I( z  k+ H6 N- \
  41. #undef EDMA3_DEBUG
    1 v* _# P+ j4 b. r5 H
  42. /*#define EDMA3_DEBUG*/
    + V, {. k4 W# g8 G

  43. " I( R3 B! ?* |# F
  44. #ifdef EDMA3_DEBUG
    $ b) j  Y. |0 Q; w. D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' u" x/ N4 p) k0 W6 W/ Y. r  k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % a2 b8 S* t; T. `/ {2 l+ {% J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- X; V5 x8 f) [- j& z; }
  48. #else
    # X- E2 z( C: k3 z  X
  49. #define DMA_PRINTK( x... )
    ( I) J+ U) S2 `
  50. #define DMA_FN_IN
    % n1 N2 J4 ?6 v' o3 R7 v* |! h- `5 ~& s
  51. #define DMA_FN_OUT6 @, e+ p' U* S# W
  52. #endif
    1 L* q( Y) o% [/ A

  53. 7 o2 G( s* F' W2 K5 a$ ?) z: U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 |$ P! d1 l- T$ C1 t. O
  55. #define STATIC_SHIFT                3
    . j' u+ Z4 A# A0 S2 G
  56. #define TCINTEN_SHIFT               208 |0 p% F( T" t9 i7 g
  57. #define ITCINTEN_SHIFT              21
    $ c7 a$ `7 w7 q/ \4 }
  58. #define TCCHEN_SHIFT                22& g& v: m$ ~2 A% N  B4 f. b
  59. #define ITCCHEN_SHIFT               23
    5 o, [- i* R: t/ o+ U5 P: [. w
  60. , ?' a# x" b( o- [0 k6 ?
  61. static volatile int irqraised1 = 0;
    9 \/ l) p$ d& V& s9 Q0 d( P
  62. static volatile int irqraised2 = 0;
    9 t  _* {' {% ]& }5 \" {( |

  63. ( _6 F# B7 R+ t$ k) {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - \; O% o4 E8 j2 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D: p3 m8 D! a( V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) a4 ?# J/ Q, r* s: X

  67. 1 a8 e5 W4 F& A/ Q% g" K, O% c
  68. dma_addr_t dmaphyssrc1 = 0;4 i$ }4 l8 w0 @
  69. dma_addr_t dmaphyssrc2 = 0;: x  _: B5 l$ A' n5 r3 ?( }, W3 Z
  70. dma_addr_t dmaphysdest1 = 0;
    & @( |, ]' g$ S  A& e% D+ S2 ~9 x5 h
  71. dma_addr_t dmaphysdest2 = 0;& }2 c( @3 P! X1 S4 a9 k

  72. 0 H1 r" V2 \$ e& O
  73. char *dmabufsrc1 = NULL;+ u  C7 N: s) w0 @1 b
  74. char *dmabufsrc2 = NULL;
    3 v# y4 M) X# K( f+ z
  75. char *dmabufdest1 = NULL;
    ( Q* u: y% d2 w( l+ B
  76. char *dmabufdest2 = NULL;
    # `* h) s( `0 |# r2 E7 ?' h  O0 T

  77. ) T1 _0 B% S* t- `- ?& }
  78. static int acnt = 512;3 V: l2 c* X1 M& E
  79. static int bcnt = 8;3 u& e% b! c: O' v
  80. static int ccnt = 8;
    ' M, T0 R6 G' ^+ G6 t
  81. , b9 Q( b- ]) Y. y, c6 v! }! H; T
  82. module_param(acnt, int, S_IRUGO);1 r% [( C8 `5 C2 [4 Q% @
  83. module_param(bcnt, int, S_IRUGO);; @7 j7 \" h% |& k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 J$ p& `2 V7 M6 O$ I0 D7 _. s
5 h* V6 t% Y1 k. a, d* C" i0 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 P$ X1 n+ q) P& \+ |; e" i  uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# V" x; _8 I& h0 \& Y* K+ E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* o( b4 r+ E) V. |8 D* W+ U
, Q* N0 F0 r* m2 e8 k  x' ^. D8 z/ W; V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-15 08:35 , Processed in 0.067618 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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