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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' V4 B1 t! ]* W) a8 f/ G" j# D
  1. [code]EDMA sample test application
    / M* T6 f4 [0 B4 \- U: Q
  2. /*2 d3 a* r: y3 b8 B$ B
  3. * edma_test.c- [* F* I/ q# f5 V) j2 l: j: R
  4. *" M, {7 k) g& b5 w
  5. * brief  EDMA3 Test Application1 E: u# z9 i4 i5 f+ t- m7 B, D
  6. *( t$ C9 ~# d5 w6 {/ N# R0 f& B
  7. *   This file contains EDMA3 Test code.
    9 ~- m+ z8 ]" J- F' I
  8. *
    8 F6 e1 \* D: w/ s5 i  h: v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ^8 J. i0 L: v( \" Y) v" g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " `- j5 f$ Q$ Q% ]# P6 h  F$ l8 X7 a
  11. *         TO CHANGE.
    * b+ a9 `5 x, O6 L4 o% W* Y' M# q& }1 F
  12. *
    . H7 V$ t8 w  t9 B+ I/ _9 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " v" I5 e! `2 {" _& g* c2 X/ ]
  14. *, S) }+ B. x& {& d+ I
  15. * This program is free software; you can redistribute it and/or
    , f1 N. f" z* q/ ?( ~. h3 K! N  \
  16. * modify it under the terms of the GNU General Public License as8 O; V( r' E( c2 E& E; y
  17. * published by the Free Software Foundation version 2.' X+ C3 l- X1 C/ g
  18. *
    2 L8 o  |6 T4 g4 z+ k4 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / Z0 l) p* v7 ^" o7 m5 t7 K$ u
  20. * kind, whether express or implied; without even the implied warranty
    1 k5 a: ?+ E5 g6 c; ^3 o8 c) n8 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% t  F" d4 Z' B' }6 i0 I
  22. * GNU General Public License for more details.$ d( z; y5 X- C
  23. *// x4 I% N; A" l. i9 ?; Q: C

  24. 2 D: g9 z; }; f
  25. #include <linux/module.h>
    1 _6 M8 E% v0 n9 y% u5 E+ X% Y! }
  26. #include <linux/init.h>
    . f  P- y! d( L
  27. #include <linux/errno.h>  K% A% q! K  p. w3 |9 x
  28. #include <linux/types.h>
    , C+ {" w$ s* o" |
  29. #include <linux/interrupt.h>: O& k. w8 k" s# {9 |
  30. #include <asm/io.h>5 s8 Z  Q1 l: i
  31. #include <linux/moduleparam.h>" F+ K5 w* v$ ?2 A! k
  32. #include <linux/sysctl.h>9 x. n# n. T- P; n( R9 i
  33. #include <linux/mm.h>
    , M! f- m' b2 a9 v
  34. #include <linux/dma-mapping.h># P  g. D3 t* G9 U( [: v3 ]
  35. 5 L1 @* W  ~& \4 w; |+ W- l0 Q
  36. #include <mach/memory.h>0 j0 r: F* K; f6 p5 X, [5 `
  37. #include <mach/hardware.h>
    " Q5 ~5 l& H' c. P$ i* W( w# m
  38. #include <mach/irqs.h>/ L. s4 B& R6 k- e3 f8 k2 Y
  39. #include <asm/hardware/edma.h>
    1 q1 X( i& Y/ x2 f# o+ m% X
  40. 4 a8 @2 [, ^1 v" g1 @
  41. #undef EDMA3_DEBUG
    7 t' P/ a5 E8 Z9 P% W
  42. /*#define EDMA3_DEBUG*/1 h5 c+ l* O0 f3 f, u3 N
  43. ( a9 `; S7 @& Z& ?
  44. #ifdef EDMA3_DEBUG
    0 R9 U9 r4 ^6 C: X2 A5 Y+ {3 [% U2 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & q$ D; h2 v, X4 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , D/ [/ e# F& h* k0 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 `  B" l# s! O# I9 K- q0 M
  48. #else
    " s/ J3 f. t5 E( b
  49. #define DMA_PRINTK( x... )
      q8 q& }$ A+ q) H, a  U0 w, [
  50. #define DMA_FN_IN
    . O3 u" ^: @; H+ f8 g
  51. #define DMA_FN_OUT
      R! v6 s/ f+ j7 U' v) @" J
  52. #endif8 D4 ]" Z5 c! \

  53. 8 U# `3 A. P2 Z* h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 ?! F7 g, l! }0 [+ j; b$ K( O
  55. #define STATIC_SHIFT                3: {% l: F4 c; W. U- e& y; x! h) A4 {
  56. #define TCINTEN_SHIFT               20
    + v; b& ?: j8 G8 t
  57. #define ITCINTEN_SHIFT              21
    ; y. R0 e% n) C' k
  58. #define TCCHEN_SHIFT                228 _- ]( s9 Y5 ]3 }, n
  59. #define ITCCHEN_SHIFT               23) O, L9 ^$ {* W+ n$ k: x: i
  60. 9 C+ {( j  U5 ]
  61. static volatile int irqraised1 = 0;5 U$ j* L  `- @) i# W' j& a
  62. static volatile int irqraised2 = 0;
    + T/ ^! m0 U0 _6 P! Z" T) S
  63. - r, G" x6 _; V( \) [' b( e8 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ?; a1 r) W( V0 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 {* y: P, B1 n/ ~5 l& J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a# C0 e  T8 `2 o9 \

  67. + L+ G- v! `  @7 H
  68. dma_addr_t dmaphyssrc1 = 0;+ K( n( B' G8 T* J
  69. dma_addr_t dmaphyssrc2 = 0;
    2 v3 W' V9 D# \
  70. dma_addr_t dmaphysdest1 = 0;
    & Z1 B! r/ X* V. E. i2 T/ x( S
  71. dma_addr_t dmaphysdest2 = 0;" I3 ^* ^8 S* _

  72. ; n4 X2 m9 j& K/ Y
  73. char *dmabufsrc1 = NULL;
    ' d) x6 [3 m" {3 w
  74. char *dmabufsrc2 = NULL;
    % C& S( D- Q2 K" x# F3 a* }
  75. char *dmabufdest1 = NULL;
    + S+ |: a& n* J/ Y
  76. char *dmabufdest2 = NULL;
    ; Y8 K' S$ W- d% D- f1 Z6 X$ N
  77. # ~. R1 B6 l4 k2 G* u  [
  78. static int acnt = 512;
    2 s& Z! b! c: e9 \) p
  79. static int bcnt = 8;
    ! M. f) ]  n2 m
  80. static int ccnt = 8;
    9 W1 [: q- r) H; Z& R3 Z

  81. . X' V9 s  g8 r1 Y  D0 _: o6 N
  82. module_param(acnt, int, S_IRUGO);6 g. w; h$ n3 C3 ^
  83. module_param(bcnt, int, S_IRUGO);
    3 F& t4 W. S) l$ u: e8 H8 A  }6 R, g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& u9 V4 l) M7 _* r1 y/ T) z( }5 Y) M  M; H2 L( V, T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ j6 v2 ], ?1 g' @2 r( Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) R  Z4 Q# f/ e& l- I& J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 B6 d: x0 J# W( p- E% L

$ ?' d" R% e. r+ ?* r. |
% ^6 M" [/ A! n, {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-26 18:11 , Processed in 0.055299 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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