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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & h) b  @5 H, J
  1. [code]EDMA sample test application: H& D* h% j2 }) b' ?$ n8 Y
  2. /*3 h4 t4 m0 @. C5 z" O6 l
  3. * edma_test.c
    % z' e7 a% N# G7 B$ P8 P# a" I' Q
  4. ** `, Z; D4 S% D$ ]1 Z
  5. * brief  EDMA3 Test Application/ M9 d4 |7 q  W( U1 L
  6. *
      t1 `+ e: ^5 ^, c+ p
  7. *   This file contains EDMA3 Test code.0 s) z2 [% [$ K- x9 r  ]) d- @
  8. *& z* b  K, r( R, S/ T6 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# c7 w# y0 v2 |9 O: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! p& @$ v/ ~; V
  11. *         TO CHANGE.
    8 i9 `. s- Y) i" X. Y/ |
  12. */ u/ L$ Y" W3 Y8 D1 E5 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ E& ?$ {& _8 t& p( u" J" ]
  14. *
    ) Z& n* X# I* @* @) J6 i! Q0 O
  15. * This program is free software; you can redistribute it and/or
    # L6 P4 Q5 o. v/ [' `$ t
  16. * modify it under the terms of the GNU General Public License as
    ) H1 ]; i0 B$ Y, {
  17. * published by the Free Software Foundation version 2.9 h8 W1 L3 S6 ~! j6 \5 C) W  @
  18. *: ^) m: @* e+ L5 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( \5 l1 I/ O7 b! X
  20. * kind, whether express or implied; without even the implied warranty4 z$ ^, z& ^0 c4 v" d/ r# v0 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" P" ^; E# q5 H3 }$ n
  22. * GNU General Public License for more details.
    5 K1 h) @3 _+ y6 Y
  23. */
    ) U3 t  k) j9 _2 C3 A

  24. $ H( |* H' t( _  l1 U7 h& W# b
  25. #include <linux/module.h>
    9 y7 e) G, `, _- q4 L
  26. #include <linux/init.h>
    & \4 C" ?, L( D" L' {5 D+ v# `
  27. #include <linux/errno.h>
    7 I/ }; [1 i9 i0 e# [* E  V
  28. #include <linux/types.h>
    ( J' L1 ~: q/ E. ~3 d. I
  29. #include <linux/interrupt.h>
    * x, [  S& @3 C. Y7 d+ |
  30. #include <asm/io.h>
    . ?) x9 z; L3 ~- N  x$ q
  31. #include <linux/moduleparam.h>4 f# k8 n6 M( h# V
  32. #include <linux/sysctl.h>
    $ R. c4 M  N! ~0 W
  33. #include <linux/mm.h>: \; n- d5 j' F' K. o4 A& h2 E
  34. #include <linux/dma-mapping.h>0 Q3 ~( j2 F1 O( c
  35. ) B4 I0 e" q7 O' z- d8 H: W
  36. #include <mach/memory.h>
    & K( d6 y( M, d" j$ \
  37. #include <mach/hardware.h>
    , Q# A. Y" G9 D* Q% D
  38. #include <mach/irqs.h>* v+ J, W- T! B
  39. #include <asm/hardware/edma.h>
    ; c2 Z  V/ N& M: B8 E

  40. % ]9 o4 I1 ^4 n3 e+ s- ^
  41. #undef EDMA3_DEBUG
      X( P7 V& r* y& \: c2 B) @$ \
  42. /*#define EDMA3_DEBUG*/) h+ R' Y. \5 A1 h* G

  43. & |% g7 ?* ^) j8 W
  44. #ifdef EDMA3_DEBUG
    7 J- g2 U' J1 E/ d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ ~( P5 i+ J- M: V" n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 o* [: \9 u# a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): F( c2 E# l/ O
  48. #else3 s' u/ |: C7 D/ J4 h
  49. #define DMA_PRINTK( x... )
    / q5 j4 U" d# I/ T; e. L
  50. #define DMA_FN_IN7 Z; m2 ~+ L4 b3 B/ g4 v# j+ U
  51. #define DMA_FN_OUT
    ! s0 P0 E# u0 T* e, a7 l2 s
  52. #endif1 U+ R+ R5 ^5 J7 T$ {! C4 V
  53. 4 m+ q6 m- E" s& Y) t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- M/ m8 y3 Y: r' [9 N8 h
  55. #define STATIC_SHIFT                3
    . f" ~7 X0 U& V% D
  56. #define TCINTEN_SHIFT               20$ i& M- q: v- }  |0 M, t( n
  57. #define ITCINTEN_SHIFT              21
    # B% R/ ?! U6 [2 p# L- y
  58. #define TCCHEN_SHIFT                226 i# y$ h6 o% P, l: v( {
  59. #define ITCCHEN_SHIFT               230 Y" a9 P" h( ~2 h$ v
  60. . @  |+ l! ~" Z+ @6 g
  61. static volatile int irqraised1 = 0;& j" D( ^$ M9 q0 X
  62. static volatile int irqraised2 = 0;
      s* h8 Y5 g' P9 R% J9 |0 [) ]
  63.   L7 I- O1 Y: }4 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : h2 ~& ~* g; d' p; d5 X# @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! l4 {0 ^% t' O8 T" ^$ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 G3 X! p& G( _
  67. - K/ B1 c0 Y0 Y5 y4 a: P
  68. dma_addr_t dmaphyssrc1 = 0;9 [) W3 ~. w* H# E& z
  69. dma_addr_t dmaphyssrc2 = 0;/ p/ ~8 P! O) J0 ^, u& B% y
  70. dma_addr_t dmaphysdest1 = 0;
      y1 A( j, N2 W2 ?* {
  71. dma_addr_t dmaphysdest2 = 0;
    " {! F7 i% e" W" [

  72. ( W6 v# a! h! k  W  A
  73. char *dmabufsrc1 = NULL;
    # C/ h4 i6 n2 K( X- e
  74. char *dmabufsrc2 = NULL;
    $ Y. |' U$ ~' e8 G4 z
  75. char *dmabufdest1 = NULL;  P3 x, W& E$ n: m" |8 L3 v( A
  76. char *dmabufdest2 = NULL;
    ( D" M  r) f0 G* B% i! [& O4 X
  77. 7 k6 R' f. ~' |, G$ h) p& t
  78. static int acnt = 512;0 W$ W  f8 g" w( m* H
  79. static int bcnt = 8;' O0 v3 ]2 u4 Q8 w
  80. static int ccnt = 8;  A$ X4 [8 b8 w4 S

  81. 8 j& f/ p% p$ q( b- g
  82. module_param(acnt, int, S_IRUGO);
    , }! b& e; F8 B& G* l* U- C7 D9 h6 o
  83. module_param(bcnt, int, S_IRUGO);/ B) v* u" T7 C. Q/ V, \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; k9 H2 w% l6 `
2 R( v! a/ G8 K( J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 d) Y! _9 S) Q) larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& C3 n9 ?" }7 `% q! R  e" M1 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 `/ }/ E3 y$ N1 D( l) C: N' ~1 I8 T. _; U0 B6 C/ A
& I5 l7 E% F; t- Z. A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 12:06 , Processed in 0.053576 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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