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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 t3 q! u  Z9 `
  1. [code]EDMA sample test application9 X  C. @$ Q+ v, i* U
  2. /*7 l7 w/ _; w# e5 }4 W$ @8 I
  3. * edma_test.c
    # C% X3 \+ U/ X" L/ n/ J
  4. *
    ( G* r0 d; k) q) ]( [
  5. * brief  EDMA3 Test Application
    ' L3 J9 T# R) _9 W7 ~3 i1 V9 L
  6. *
    % L( H2 a3 B1 r9 h
  7. *   This file contains EDMA3 Test code.8 p7 ]5 ]: L- q
  8. *
    ( d0 ~+ J3 i! \1 a: {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 f8 n, W4 M& ~1 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 P8 ~) v3 V+ M2 \& @# d( `; x8 i# [
  11. *         TO CHANGE.
    % m& C) S! q; }1 O8 _
  12. *: x+ l9 X- k3 }9 W7 \0 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . p4 A( q9 V8 D9 I! t
  14. *8 @/ d5 M- a& @# p- [& s0 g
  15. * This program is free software; you can redistribute it and/or6 V& K, `, S+ a  M9 }; ~  G7 f
  16. * modify it under the terms of the GNU General Public License as
    " D8 u- s5 e' C# d% Z# S
  17. * published by the Free Software Foundation version 2.
    ( Z/ ?9 ^5 K7 t3 _* O9 o9 _2 Q
  18. *
    8 J& D! |6 v1 G7 ]+ t" |) A  L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 a" V0 v- ]7 j! {
  20. * kind, whether express or implied; without even the implied warranty
      R. M: e: W& J6 Q5 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* {3 p2 n' P/ `& F) z" D% r
  22. * GNU General Public License for more details.
    ) U* v$ c: [5 H& I* U8 ^2 o. [
  23. */; n- t  a: k5 O* e9 \

  24. . W0 ?6 p+ g# P' U# U: z% b8 [
  25. #include <linux/module.h>. S4 V. w% k( Z, O  Y& a
  26. #include <linux/init.h>
    & w) T1 B1 b; H* [
  27. #include <linux/errno.h>1 k. O4 B+ \8 V, l# p
  28. #include <linux/types.h>& Q0 m: b4 s8 R, L! s4 s
  29. #include <linux/interrupt.h>
    9 V* |5 ?3 }9 \8 L4 z* l
  30. #include <asm/io.h>
    0 |! q  ^2 b8 X/ N' y
  31. #include <linux/moduleparam.h>8 R  i. b5 j9 x3 ?- Q5 k- c
  32. #include <linux/sysctl.h>
    * m; ]9 B  R& V
  33. #include <linux/mm.h>
    % \2 t# v7 |: A6 M2 i
  34. #include <linux/dma-mapping.h>6 i; d6 F/ U6 {
  35. % k- E% T" X1 O# q* a
  36. #include <mach/memory.h>* D. J. L/ k6 D. {- c& S5 I
  37. #include <mach/hardware.h>! |/ t. n( y( S4 r
  38. #include <mach/irqs.h>* C) z1 r4 \/ b7 C6 x# B( G
  39. #include <asm/hardware/edma.h>% U2 d* e% |, o% p: B- q* h4 e

  40. " z( Z4 L# s  Q! K, Q2 G5 S
  41. #undef EDMA3_DEBUG
      L, a* e  Z3 O0 p. k' v8 |! b3 f1 Z
  42. /*#define EDMA3_DEBUG*/1 u* u8 D  K; x: \# p. d: B

  43. ( z1 L. F9 H! @( ^# o" _& K# E
  44. #ifdef EDMA3_DEBUG
    ! u* f& j, s. r! f2 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" s" I4 Y8 x' Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 t! q" P! Q7 K- h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . X( M* u+ I/ C0 j% v9 n' [) n: k
  48. #else, u4 g; t/ \2 E) N
  49. #define DMA_PRINTK( x... )2 R( S/ [+ F6 h7 F6 N
  50. #define DMA_FN_IN" g+ T5 I: s6 d& W
  51. #define DMA_FN_OUT! ]6 |: A. q* P5 G" W' @
  52. #endif
    ; V' E5 U- ~+ T8 R- h; W
  53. 4 D) K2 g' k; [0 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 x: M  q1 N; j/ C
  55. #define STATIC_SHIFT                3
    ; |' \4 Q  k6 u7 z( E$ U
  56. #define TCINTEN_SHIFT               20- F3 f5 y2 Q5 |
  57. #define ITCINTEN_SHIFT              219 Q) [6 w- r( U
  58. #define TCCHEN_SHIFT                22
    + @- S! J% i+ F9 M
  59. #define ITCCHEN_SHIFT               23
      n3 ]6 _2 ~: e3 a$ ?
  60. ; Z1 k2 R: v# {8 z. N
  61. static volatile int irqraised1 = 0;
    ) u& |  r! B9 U# m# M9 @
  62. static volatile int irqraised2 = 0;! j: V  I5 ^' K  ~% b/ w4 t

  63. 0 s: Y% F3 n3 n0 Z; z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ p7 L2 Y5 Q! C/ c: i$ U4 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' q3 _3 n* `+ Y" o# S3 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  F/ t: Y: l# a3 M) a
  67. * Q" p% g0 Q  }7 ~! @! g* F6 }
  68. dma_addr_t dmaphyssrc1 = 0;+ `( y3 s. c; R; ~% E- F" a$ O
  69. dma_addr_t dmaphyssrc2 = 0;
    7 L7 g: l) }/ v( t1 q  L
  70. dma_addr_t dmaphysdest1 = 0;# z- x4 _  l8 a
  71. dma_addr_t dmaphysdest2 = 0;
    / k/ s4 H! M" E+ q

  72. * k$ N4 f  ^( k6 c+ k+ p/ C; Q
  73. char *dmabufsrc1 = NULL;' }0 L" z2 N8 D& l4 M/ _: j
  74. char *dmabufsrc2 = NULL;9 b5 n2 D3 P6 g0 k* P
  75. char *dmabufdest1 = NULL;
    0 u! |: Q( m9 m5 L. @
  76. char *dmabufdest2 = NULL;
    # V. n2 k) I8 @* d

  77. . Q# p$ E# O# c" j" E& U: V4 p
  78. static int acnt = 512;* Y8 ]. f& Z  V+ J8 }7 k" q
  79. static int bcnt = 8;
    6 _# j4 ]* ^% n! W
  80. static int ccnt = 8;
    8 l& y' I& S4 n! y  ]

  81. " f+ C/ r6 l$ ~3 d! q
  82. module_param(acnt, int, S_IRUGO);  V. s8 j: f4 C# E, y- ^
  83. module_param(bcnt, int, S_IRUGO);5 c$ f( \7 u+ a# D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( [1 L. j1 H  R1 m/ ?) ]0 d4 x$ T5 Q' ], ^. e$ m( Y6 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 N4 R* P( k& w6 Z2 _& d2 R0 O5 l9 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 k9 H! M! y) L5 v" k( u# Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ b, o" P' [: b2 O8 I. Z& K5 e0 J; b' d% C1 n
) o& g2 o+ b, _$ h3 [6 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-3 15:21 , Processed in 0.040818 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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