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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* X; o' H# d0 A+ t
  1. [code]EDMA sample test application
    1 A4 O" t8 t) s+ `& r
  2. /*8 n# x: p' Z' o/ g' R1 p
  3. * edma_test.c
    ; g) X2 s# l+ G/ d. ~8 N( y4 O
  4. *
    " @( T# W2 r+ i1 H2 x1 u2 g2 n
  5. * brief  EDMA3 Test Application
    ! Z! y( V' f/ V& g& {9 Y8 v
  6. *# k2 q$ Z# ?# G6 r/ m( _
  7. *   This file contains EDMA3 Test code.. `; D: g9 W. g
  8. *
    - J8 A- q7 [. r, O( e8 k3 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( l3 m  ?0 V& ?. z6 P' L$ \, V1 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, h  m2 Z: h9 @& M0 {+ m$ Z
  11. *         TO CHANGE.
    7 Z6 E  ]7 B9 w. }$ ?7 N4 x
  12. *# ]# ^" o" @6 K7 Q) f6 A8 E' q. n3 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 a. m5 z1 C- w0 `- p
  14. *) z3 g% B1 d' L* ?  w
  15. * This program is free software; you can redistribute it and/or2 {& R- G  X, W  I) O; B9 `
  16. * modify it under the terms of the GNU General Public License as3 H  Z! s3 n% t' `
  17. * published by the Free Software Foundation version 2.
    4 m. y5 ]9 Y& f( ]& ^. G
  18. *. k: Z& b& W- g( L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; ?; F4 i1 u& \0 L7 l  ^. w& y
  20. * kind, whether express or implied; without even the implied warranty) V& v( \* u4 y2 D9 w3 S2 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 U' H, C! B3 C! G1 a. z# n$ m2 A
  22. * GNU General Public License for more details.9 e4 w% \' ^5 d6 ]
  23. */3 Z3 l7 z; ?& G, W8 B( r7 m

  24. # D1 s9 L& c! A+ U4 R" W/ C: b: G
  25. #include <linux/module.h>( T% G9 z& v" @  W6 V( h
  26. #include <linux/init.h>3 c4 _3 h5 z6 s1 o+ f7 O
  27. #include <linux/errno.h>
    , ^7 p6 Y9 X  W' b5 N
  28. #include <linux/types.h>
    6 B9 u9 g3 @0 ]7 Y8 l
  29. #include <linux/interrupt.h>
    ) O3 Z+ @3 W9 V8 H
  30. #include <asm/io.h>+ \) N# P' ]. x* D( f  ^& t$ ~
  31. #include <linux/moduleparam.h>- i/ \! W" i0 z8 x
  32. #include <linux/sysctl.h>% }* I9 `: H' ?% C! h1 Z
  33. #include <linux/mm.h>
    : \7 }- F) B: J! Y  p% S. A
  34. #include <linux/dma-mapping.h>3 z- |: w6 M+ l2 q1 a( ~0 T  [

  35. 7 Q3 h1 T. [1 c  U: M. Q7 ^3 u
  36. #include <mach/memory.h>; k! n" B* b6 u- C) Q9 Y" n
  37. #include <mach/hardware.h>
    + p5 F7 C: |, p% N
  38. #include <mach/irqs.h>* K- X- G5 v% P# q! U
  39. #include <asm/hardware/edma.h>; X( n9 i  `. ~6 z' E( J

  40. 2 y& L7 z4 h5 b1 o9 r2 r2 _' t
  41. #undef EDMA3_DEBUG9 F' [6 P. S. Z" q  i  s  g
  42. /*#define EDMA3_DEBUG*/
    3 U" A; G8 S7 g* ^5 U) t; P% d
  43. $ j4 Z, v1 T. e% p/ U5 Q" s$ r; ?
  44. #ifdef EDMA3_DEBUG1 }8 G1 N6 [) ?0 ~9 r/ l  X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 o8 a) ], T! @' g. m! Z6 w3 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) Z" W: Z. g% e4 h& E2 m; S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ D5 V, K# [: d6 C6 X" p
  48. #else* W, y) s& V0 g( _! E, V( u! u
  49. #define DMA_PRINTK( x... )
    . r: M" d7 a. W9 m2 q
  50. #define DMA_FN_IN7 l, K3 f6 M: t% w6 n( F
  51. #define DMA_FN_OUT3 R# H" z% X, g( Y' E
  52. #endif
    0 ~" i0 j4 X# D: n( F
  53. * @1 v& P1 B" O" T. V! \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 Y0 j: A  `5 ?# m5 Z
  55. #define STATIC_SHIFT                3/ e! \% f$ T# n  z, i8 k3 s
  56. #define TCINTEN_SHIFT               20
    % j1 _# }5 F( p' k- P
  57. #define ITCINTEN_SHIFT              212 s+ T( ^* @5 n! F( C
  58. #define TCCHEN_SHIFT                22; |( d1 u* c( K& U+ n  F
  59. #define ITCCHEN_SHIFT               23, g3 g1 Y9 p, C0 j# R0 N  k+ d
  60. ; g! {8 T) A- {8 v
  61. static volatile int irqraised1 = 0;
    9 N3 Z. s; C2 N# e- m
  62. static volatile int irqraised2 = 0;  m: }1 d' s( a

  63. + [$ n$ ~% ~! G, Y2 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y, u' C  Y; ?/ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# S* k8 ^5 S3 s. e5 `$ B6 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 g& t+ P6 z' L9 E( ?

  67. 2 E& X- G9 o' d% X, `, d2 l
  68. dma_addr_t dmaphyssrc1 = 0;, D: ~" a# Z* [/ b2 p( e
  69. dma_addr_t dmaphyssrc2 = 0;  ]7 ?4 b7 C. r3 {; c
  70. dma_addr_t dmaphysdest1 = 0;
    * l& v3 h% ~+ E# N% ]
  71. dma_addr_t dmaphysdest2 = 0;$ O' k  _0 L# j$ T0 e2 f) ?0 {

  72. 7 \( E) ?, b. }( q) }6 z$ X
  73. char *dmabufsrc1 = NULL;
    8 W4 s( R  \! M& T9 M
  74. char *dmabufsrc2 = NULL;; m3 F* a3 A2 f% t# B) H9 V
  75. char *dmabufdest1 = NULL;
    0 }; W  f- }! @3 Y- ]0 t$ Z
  76. char *dmabufdest2 = NULL;" X: X3 B: `# y$ i
  77. " I: Q; C4 u. ^( ~6 K
  78. static int acnt = 512;
    + m+ j4 U+ a, ~$ \# ]0 C
  79. static int bcnt = 8;
    % d0 W% i4 {; b  s) m& S
  80. static int ccnt = 8;0 T1 h$ u! N: V& K9 V5 ?
  81. $ `; b7 q6 x) I3 D4 C3 J+ K- t
  82. module_param(acnt, int, S_IRUGO);% A1 c$ n; G  e
  83. module_param(bcnt, int, S_IRUGO);% Q7 J! y' j. O$ Y" I' [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 D$ [9 }, F/ z( p
# V  `# R" `( q0 t: I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: b6 k8 F" s6 N( m9 |/ X  {. g
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 `, P* a& V5 F% L" r+ p8 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* I9 Q7 h2 ~0 C$ ~# v5 s% @/ A1 x

/ h/ p7 S  o+ B& O0 i" {- n
* Y7 i) j. @2 t  ~1 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 01:14 , Processed in 0.042279 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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