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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 [- [, p  t+ y$ V8 m
  1. [code]EDMA sample test application  ?" R% X; `; b- l
  2. /*
    ! J& X) z& n3 i  U+ i  k& Z2 \( B
  3. * edma_test.c
    1 K. x+ t0 n/ a& S- b
  4. *
    5 s# ^5 \/ v: a7 s
  5. * brief  EDMA3 Test Application9 j0 ], d3 g5 k/ V4 ^
  6. *: a4 M3 U9 D; [- c; f
  7. *   This file contains EDMA3 Test code.- m/ K+ K/ U% K! m& H+ t
  8. *  p# b% a, O; O# c7 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  Y+ m& H$ ~6 x$ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- X6 r& z9 ?$ Y7 M
  11. *         TO CHANGE.: e9 S. t2 a+ T7 c3 i
  12. *
    % ]& D+ ^' B7 v% s7 e* F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 R/ C1 Y( j+ M6 t
  14. *
    6 b" m& L+ P9 {# g  {1 n8 b
  15. * This program is free software; you can redistribute it and/or% Y! l: l' ?# w0 ]# R3 L* }- `
  16. * modify it under the terms of the GNU General Public License as0 x+ j+ E$ r+ w4 e+ U. \% F6 P" L# ~
  17. * published by the Free Software Foundation version 2.
    4 x) O" X! q& v/ k4 }
  18. *5 Y% g3 G$ T+ E; E# X+ D5 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# K6 F( p& V$ Q' A% Q' |/ @
  20. * kind, whether express or implied; without even the implied warranty' B5 H$ G- J% x' ?0 t) t: Y2 T5 A; z+ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( a9 l- R+ X3 j& }3 _+ W! ~
  22. * GNU General Public License for more details.0 }% I2 Y, s" O. v) f
  23. */
    ; n& b: \. p6 i) `7 d' g: I
  24. , ~3 d) d0 P! }6 ^
  25. #include <linux/module.h>
    . C- u5 N! n1 Y; Q1 V
  26. #include <linux/init.h>
    5 P8 k& o; R# Y0 E' X2 v
  27. #include <linux/errno.h>
    & W$ ]7 L. F) M: E9 m& A* K& Y5 o
  28. #include <linux/types.h>
    0 D+ h0 b7 D9 _, x/ z6 V
  29. #include <linux/interrupt.h>
    0 ]0 t2 {9 S8 {! [0 Z
  30. #include <asm/io.h>" K4 j+ P3 U) v* c2 F( B
  31. #include <linux/moduleparam.h>) Y2 k! ~; [1 M8 [  d
  32. #include <linux/sysctl.h>
    $ s  Z9 z, V+ M. A1 t
  33. #include <linux/mm.h>
    ; r! }& s4 ~! `# _
  34. #include <linux/dma-mapping.h>
    , {! \$ @2 K" e* l& w! S
  35. 5 I. U8 h' E5 l
  36. #include <mach/memory.h>
    9 Z: Q/ H+ K2 n3 z1 h% T
  37. #include <mach/hardware.h>
    + D" d( B. y; j# W8 J2 @
  38. #include <mach/irqs.h>3 y, ^" T  f5 G. }
  39. #include <asm/hardware/edma.h>
    ; H/ y) r& c& {6 W! I! N% a% z; r
  40. " D0 K. Z5 x" a# _- e: k4 u# o
  41. #undef EDMA3_DEBUG5 @% F3 L8 J4 `
  42. /*#define EDMA3_DEBUG*/  u. [' O- n* g
  43. ; d5 _' D, E% {3 i" b+ t
  44. #ifdef EDMA3_DEBUG! b" U/ B0 b$ c8 M  p& u  H% m. L9 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 e+ b  g" A, U* Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + m& ^6 J5 _7 S0 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); f* F' q$ U* v) A4 Q- t6 ^# c
  48. #else" N$ E% b1 o0 ~% }# Q# w3 }# C/ W$ _
  49. #define DMA_PRINTK( x... )1 l+ G9 |0 y( u2 o& I
  50. #define DMA_FN_IN* K0 F  B0 e# K
  51. #define DMA_FN_OUT: o1 r  T& m7 M: @, |
  52. #endif
      o; ^: r8 m& T, Q  X+ {7 x, K
  53. / W' n+ c1 c5 Z! p# J& B# l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % o- C4 q% g# c! |7 `& B
  55. #define STATIC_SHIFT                3
    9 O! c$ I6 N" G# {1 N9 h+ n/ b! ~+ g
  56. #define TCINTEN_SHIFT               20
    & A* D  f) C3 R5 q3 B4 A" q
  57. #define ITCINTEN_SHIFT              212 Z: s' ~2 t6 F3 t
  58. #define TCCHEN_SHIFT                22
    ! U9 X$ [, I3 n8 Z* v5 @
  59. #define ITCCHEN_SHIFT               23+ Z8 |1 m* y  e
  60. 2 P! e% [; ~$ q5 `+ D, P
  61. static volatile int irqraised1 = 0;& {( Y; @* U$ N; g0 i) I3 Z. [& M( {" m
  62. static volatile int irqraised2 = 0;
    + w- P4 H0 _: B; H) V! J
  63. % O0 q/ Z4 q1 n0 d8 q% a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o! y" q4 ?  M2 G, Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S$ w; G' n/ M+ H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y  e0 L5 ^6 d& t
  67. , `/ M; a/ S8 b0 @
  68. dma_addr_t dmaphyssrc1 = 0;  Q- l- Z. R  ?4 _" P6 [+ j! z
  69. dma_addr_t dmaphyssrc2 = 0;
    , Z, n  ?/ a6 {+ }/ k- g
  70. dma_addr_t dmaphysdest1 = 0;3 g* V# I! ~  O8 r  R- U1 Q$ d
  71. dma_addr_t dmaphysdest2 = 0;
    ; g# B+ h/ J) @8 y5 q" w- Z
  72. ( O  Q6 P9 d3 ~" v- o8 f, S
  73. char *dmabufsrc1 = NULL;! @( L: z9 |, Z7 K; U. S" `
  74. char *dmabufsrc2 = NULL;4 A, F) `1 O1 j5 q1 [+ L" n
  75. char *dmabufdest1 = NULL;' b% i. J* i! S: f$ q/ }) ~0 y
  76. char *dmabufdest2 = NULL;: g  H! V* ~: d7 k) \

  77. . L0 F6 r8 w* t
  78. static int acnt = 512;
    * ^' m  k3 T+ ~; F: P2 B3 _' b
  79. static int bcnt = 8;
    5 L& O4 E' ?5 C* _- V  u' O
  80. static int ccnt = 8;8 c$ i/ b9 G& r4 n' F

  81. , L" f3 K) `" y% t! G6 A# L) X' U
  82. module_param(acnt, int, S_IRUGO);: ~. M, `. j# q- I  L
  83. module_param(bcnt, int, S_IRUGO);% \: R% h8 d% G* x6 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' w% q& S; S% @7 o; `; ?  p  L
4 U0 ?) g# f- [) a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ F: }9 s6 T  L/ e/ Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q9 ]# O# M2 i/ s/ W) E- l' P) U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! [5 U' X" v7 i2 h
: x$ \4 C/ t, E7 w$ t5 B9 T- @1 a
% w) o# a- ?- y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 02:32 , Processed in 0.038410 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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