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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 U$ ]7 k% t$ n. ?* y, t
  1. [code]EDMA sample test application6 V: P/ k9 |+ }" G! \& Z7 r
  2. /*5 ?. x& X6 V6 J" ?7 _5 |) ?
  3. * edma_test.c
    ! F# G; Q# b2 D
  4. *
    " K. y* u, u: n& [4 I, `
  5. * brief  EDMA3 Test Application
    $ e" O  f5 }; C  V3 k3 h+ W
  6. *
    8 V( o4 s" @0 P, x7 t6 q2 g
  7. *   This file contains EDMA3 Test code.
    : ?$ y" v( I5 U1 Z( E: E
  8. *
      m: {5 O* h8 Z& }/ B( S/ `& G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * _" e2 y& A; S+ V- o) A% O; X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 b% o, i4 Q  ^9 r$ i& c
  11. *         TO CHANGE.
    3 V9 m' ]$ h3 k. v# U
  12. ** G  ~" ]: `! m% A* @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ S" I+ j% A+ J" {4 _
  14. *' v+ A0 j3 \4 x# j
  15. * This program is free software; you can redistribute it and/or% m1 h: e+ z+ o! L
  16. * modify it under the terms of the GNU General Public License as
    4 J- a9 O% V  K* q- h
  17. * published by the Free Software Foundation version 2.
      @5 v2 t; v2 P" I
  18. *
      m' F, S. ?  Y: y# N' j' ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 \9 J4 x% {) N$ {
  20. * kind, whether express or implied; without even the implied warranty- h  ?* Z3 C  O# \# z7 S/ z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. L0 j; o; _1 H9 p
  22. * GNU General Public License for more details.
      ^1 \* `/ }0 M: I9 z0 o
  23. */
    5 I5 H; P; f4 k8 m6 `# f' b

  24. # o  z7 v1 b5 n  `
  25. #include <linux/module.h>, E! l% O+ V# h% c4 U
  26. #include <linux/init.h>
    - l/ d6 P% Q" U" m
  27. #include <linux/errno.h>  ^! v3 X8 G2 x& n0 @. S) P  {
  28. #include <linux/types.h># Q/ k. o7 U7 S; O! o
  29. #include <linux/interrupt.h>
    + z9 v* P# U4 H& L
  30. #include <asm/io.h>! h4 P9 s+ X2 d: V# R4 c
  31. #include <linux/moduleparam.h>
    ) u/ A' \, K  l
  32. #include <linux/sysctl.h>
    9 |, a$ n- o4 J8 i+ P0 e. a
  33. #include <linux/mm.h>  }3 s$ p& b4 t6 c
  34. #include <linux/dma-mapping.h>: w( }3 s* ?4 x
  35. 4 T+ D: o. g7 P( N- s) o
  36. #include <mach/memory.h>
    , o2 b. M; p! i' V
  37. #include <mach/hardware.h>6 U, l# W$ y3 {" v! K0 T3 O4 c
  38. #include <mach/irqs.h>
    $ i5 r* l3 ^% \8 M1 d: m" |
  39. #include <asm/hardware/edma.h>
    3 e( H2 b3 p1 N! H* H0 F. J
  40. 2 r0 D- U8 m' c5 `. n; z' V
  41. #undef EDMA3_DEBUG7 X9 T; K( h; }9 p2 U4 M
  42. /*#define EDMA3_DEBUG*/
    ) X. h, _- s9 `: C! L0 [
  43. 8 F! J9 Z$ `5 h, u* R3 Q
  44. #ifdef EDMA3_DEBUG4 A4 d0 v) z$ I8 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 e) {) X" I: C7 W2 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( O8 [5 M" ^5 w4 b% c- }% f: i- R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" O: A9 D/ X' F) r# t7 [) Q
  48. #else6 F' n; x; i2 Y& s! e: y. K
  49. #define DMA_PRINTK( x... )
    9 X8 G& y1 X1 V
  50. #define DMA_FN_IN
    ) @; }& D6 R# M3 B" f; V- p4 a5 Q
  51. #define DMA_FN_OUT
      w) h0 Z9 X2 ^! V+ ]9 [# {
  52. #endif1 g9 i; D$ b  H- L# E* `

  53. & m: ^# C- ?( N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 a" D+ G# Y7 S
  55. #define STATIC_SHIFT                32 }7 Y/ v; c8 e) h! g2 z8 [1 [
  56. #define TCINTEN_SHIFT               20* K7 l+ _9 c/ y' T$ M! R' {5 s
  57. #define ITCINTEN_SHIFT              21
    ( s+ P$ v; r0 q/ G
  58. #define TCCHEN_SHIFT                229 ?( k" N2 t4 E! m* T) R
  59. #define ITCCHEN_SHIFT               23! u$ y9 c% i4 C; B: |6 N9 G8 i

  60. 8 A' h! s: `4 f4 w9 ^0 _8 C
  61. static volatile int irqraised1 = 0;
    6 s, A! k! C! f6 S
  62. static volatile int irqraised2 = 0;
    . h, K* e( K  d0 C  J
  63. : b+ \$ {$ R$ G! Q+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      z8 |& k1 ~- i8 c$ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g* j) N% S/ j$ i6 ~" a" ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; y6 Y! m: i$ B: W

  67. , ^, t) ]; b7 k" u* R- i
  68. dma_addr_t dmaphyssrc1 = 0;
    ; s' h# i) N/ y
  69. dma_addr_t dmaphyssrc2 = 0;
    4 F8 R+ m- o/ l) E0 A; @  \; ~
  70. dma_addr_t dmaphysdest1 = 0;
    8 M/ t2 D! D8 p' T, u& B# L
  71. dma_addr_t dmaphysdest2 = 0;
    & m5 y3 |6 g" J* K2 z) d

  72. " W4 S! Q4 H% _  D) w3 Z0 i
  73. char *dmabufsrc1 = NULL;2 a8 C  Y! y; ?8 v
  74. char *dmabufsrc2 = NULL;
    4 f8 [4 L# w- n3 f; a# |9 v
  75. char *dmabufdest1 = NULL;# @7 d& L. w& b9 k
  76. char *dmabufdest2 = NULL;7 |" S& Q7 |$ M& P5 @- M

  77. ! S2 ~' H2 D# }5 b% F' ^; ?4 S
  78. static int acnt = 512;% _; G" }0 m' l: i: l
  79. static int bcnt = 8;" P5 H5 Q# a( |+ |5 H2 g( X
  80. static int ccnt = 8;
    ) ~# ^" S4 R9 G0 w& `

  81. % ^8 I* f) M! y6 H# w% O' b1 X& @
  82. module_param(acnt, int, S_IRUGO);
    8 l& J3 B+ }3 d% K& Y0 ~  [" f
  83. module_param(bcnt, int, S_IRUGO);  s( v6 j" _9 }' ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: ~7 M6 }9 ~8 Y- R% V& @1 ~3 ]- k; U, r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ {3 \2 U) Z4 X) z0 E, T: B# @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 H5 B; m4 ]! `! A3 n- L9 z- R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 i% z; C) d8 y9 t4 \4 e
" t: z1 e+ g$ `0 r
+ Z6 E* ^# Q" v. z+ _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-30 08:20 , Processed in 0.039150 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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