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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( w( ~) a0 x% d
  1. [code]EDMA sample test application1 m7 e1 D% |. ]: p" T) g( R
  2. /*
    7 c; h8 H) }) J( _7 @3 k
  3. * edma_test.c
    8 t- T+ T! u8 K+ P
  4. *
    / \, b: l) Q% b" u$ T
  5. * brief  EDMA3 Test Application- M* j, O, R0 M0 G4 S4 J
  6. *
    % s0 f9 l4 E3 _) R! q; h9 s3 n: Q
  7. *   This file contains EDMA3 Test code." t  E( o- W2 x4 W; {6 E9 a
  8. *
    4 _+ @# E7 K/ J  G+ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 P) T. x5 U6 T5 l' n! S3 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & n+ [; y# K7 g6 a1 L* w1 n- t
  11. *         TO CHANGE.
    2 k* B( u) }; K% `
  12. *
    * K6 P8 K" M6 w4 ]( h( V. \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ?% R5 N2 y$ |5 A$ |
  14. *% L( a1 E* U( o) e: \) x
  15. * This program is free software; you can redistribute it and/or" _) e" j; h1 w' x8 t# I& m/ a1 Z
  16. * modify it under the terms of the GNU General Public License as4 x4 A2 {& |# K% @, _$ f4 Q
  17. * published by the Free Software Foundation version 2.
    4 N* {4 J0 X. F: t' N3 y1 _* s6 |
  18. *+ {  c* f9 W" k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 {0 b5 x1 j! X, L. x
  20. * kind, whether express or implied; without even the implied warranty
    % J  i; u8 A  r: |( n8 X3 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' l) O# n, r( r, @. U  i
  22. * GNU General Public License for more details.
    % X. T! M: |  L# C- w8 S
  23. */
    8 i0 Q. h& [. o! Q! T7 s* f1 D

  24. * {6 G! f$ R# V4 @4 y' K& c
  25. #include <linux/module.h>3 _' T2 A% H) J( J" q( V" a/ t0 m
  26. #include <linux/init.h>+ F6 T2 O) j% k7 M5 ~( N  }
  27. #include <linux/errno.h>+ v$ j/ C9 U1 E
  28. #include <linux/types.h>$ g% ?; k' E' f9 j- p5 l) e
  29. #include <linux/interrupt.h>4 g9 m$ u7 S, @' N/ |2 a
  30. #include <asm/io.h>- A( U( F; d8 K# y; A/ ?- J% f* B7 h
  31. #include <linux/moduleparam.h>5 @% {. L7 L4 A, `1 c& t# v2 {1 e
  32. #include <linux/sysctl.h>
    * M, E' e! M: g" M5 m
  33. #include <linux/mm.h>3 T3 J" g* M6 E; G8 B4 p6 _! t4 H
  34. #include <linux/dma-mapping.h>/ ^% m& p9 A# g$ ^' p" {7 |

  35. % [5 B7 x* O: Q1 Y# ]- q
  36. #include <mach/memory.h>
    ' e" t* f0 Y# a# D- {8 C- [1 u3 d% i
  37. #include <mach/hardware.h>
    + l' ^) t4 k  T1 T
  38. #include <mach/irqs.h>! a; U4 P. p' c
  39. #include <asm/hardware/edma.h>
    / d& M3 J& u+ [2 n* z% T! `7 g8 k
  40. ( [) P5 q" s# n- @) ]! }& Z$ F
  41. #undef EDMA3_DEBUG
    + h7 d: x9 \# `
  42. /*#define EDMA3_DEBUG*/# F0 g$ x& q4 v3 Q3 K* p& {1 _
  43. , G( l6 N/ T# o; ^& [) Y! K
  44. #ifdef EDMA3_DEBUG
    5 Q5 Q7 ~7 v: h3 S# U# z7 `; O  U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / A! \) Y: @9 B; C4 a1 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + w! A, Z2 V7 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 O1 m$ ]. @* m% ~) A
  48. #else
    " R; Y; d* u& B, j$ m; A
  49. #define DMA_PRINTK( x... ): \. E+ {! Q+ R  }) t7 l4 I7 ~6 \: |
  50. #define DMA_FN_IN  m* R* e& s$ U* M: `% o
  51. #define DMA_FN_OUT
    / m) d4 \9 |1 ]5 |& _7 S! w
  52. #endif
    & a2 P3 y  M2 @
  53. ! ?" T3 f& k3 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) l  U) Z- @* F; J: }3 J/ m) d
  55. #define STATIC_SHIFT                3* L  y3 E# Y5 ^
  56. #define TCINTEN_SHIFT               207 A/ v+ n+ W4 A$ o* ^3 N
  57. #define ITCINTEN_SHIFT              21
    : U/ ]9 }8 N' d9 @: D, j7 i
  58. #define TCCHEN_SHIFT                22$ z( y% L9 {; t0 U2 B) J$ w; R& m. W
  59. #define ITCCHEN_SHIFT               237 A6 o7 I- t: S, `* K
  60. ( z0 z6 ?% b, G9 Q9 _- i+ q, `+ F
  61. static volatile int irqraised1 = 0;) \, d) s' P& w% B) v% y
  62. static volatile int irqraised2 = 0;  J; }' w, x* l

  63. " d( f1 f/ V0 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : b8 @* ~7 u/ H4 F$ x/ {3 K/ |! h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 i1 S0 L0 V$ o; t: I7 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : w9 w& w- ~, V; q# i2 [5 b
  67. : d! l' P4 I( J
  68. dma_addr_t dmaphyssrc1 = 0;: u* \- [& {2 Q9 E, o
  69. dma_addr_t dmaphyssrc2 = 0;: D* l3 ?; l$ ~) E# G2 q
  70. dma_addr_t dmaphysdest1 = 0;
    5 a/ o2 `. i4 @/ m
  71. dma_addr_t dmaphysdest2 = 0;
    . G! {; _+ f( T6 R8 |. ?* A
  72.   W3 O9 V2 F$ Y% C$ r2 s
  73. char *dmabufsrc1 = NULL;  D' j- `- `' U4 \; ?' Z2 f
  74. char *dmabufsrc2 = NULL;8 o2 [" o- |9 }- L9 r
  75. char *dmabufdest1 = NULL;
    9 ]" }- g  D/ ^
  76. char *dmabufdest2 = NULL;, n+ _: x% f& M

  77. 8 e* C9 E0 R# k
  78. static int acnt = 512;0 u: x: X* t, T
  79. static int bcnt = 8;
    3 e& M; {6 L' o. F
  80. static int ccnt = 8;2 L6 ]) q& W) U$ n; q  \7 ^/ e

  81. 5 L/ \, \( |5 z# B6 `' @
  82. module_param(acnt, int, S_IRUGO);- D$ m& H+ }# r- M: V: Q# E% R
  83. module_param(bcnt, int, S_IRUGO);- e5 s/ f3 `) @" Z& w" O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* q9 K+ {/ V, B  l7 D% ]* T: B1 t9 n4 G4 p) D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  R" @3 b# z1 x6 v, F6 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  |5 J0 C5 @# f$ A- i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 W& X% |0 `2 d' k( t9 R

$ Q, O+ V. i! Y! E# {5 \$ x% ?
, |$ }' \* y: @" \3 D, e/ S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 14:35 , Processed in 0.049377 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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