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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 a1 k' E$ W- j' c
  1. [code]EDMA sample test application; l1 c: z6 }% g2 l  ~2 q6 f! }  A
  2. /*$ {8 i3 W% j, t  D4 F
  3. * edma_test.c
    ; P2 N' w5 n9 {0 U
  4. *+ k3 F- b, b' ~1 |
  5. * brief  EDMA3 Test Application/ a7 R& k5 f9 T; I
  6. *
      l% c! q* \' s* k* w: I- f
  7. *   This file contains EDMA3 Test code.( R/ T7 s' ^, s6 I3 S
  8. *& o4 ^6 W0 ]! Y* |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% {4 d# t4 w$ b4 ^9 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + h2 v$ h2 F, ~+ p/ E  m2 o2 Z
  11. *         TO CHANGE.9 ?; U: s+ v" R) L( g
  12. *5 J( A3 \/ \! Q' @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 W+ L- O2 X' F' o" ^$ b( \1 a
  14. *" E. x# |4 n8 S# Y  `- r
  15. * This program is free software; you can redistribute it and/or# O9 S: ?6 L) I1 h) Q
  16. * modify it under the terms of the GNU General Public License as
    2 O. m$ f9 v' z& o8 G: K
  17. * published by the Free Software Foundation version 2.% Z4 t+ u6 }4 ]
  18. ** E/ D0 U; i7 S* x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 l7 p7 E" B$ {/ l5 S1 p
  20. * kind, whether express or implied; without even the implied warranty
    9 t: `9 q# W9 \$ e' a6 Z+ }& x2 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- G1 [0 a8 _$ ]* c  M4 J0 {3 E
  22. * GNU General Public License for more details.
    * f9 r; @/ b3 a9 H& L
  23. */5 I: }" w" @+ p  G! [, R

  24. 8 `" f1 f0 j' G" q7 q$ H1 F. u
  25. #include <linux/module.h>
    8 G8 N# I; v5 a# ^  K
  26. #include <linux/init.h>
    8 B1 @. B- \/ w! U% `
  27. #include <linux/errno.h>
      E: A9 d" K6 }; h4 @" U  Z
  28. #include <linux/types.h>
    6 k& Q" _, O# j+ u0 a9 s
  29. #include <linux/interrupt.h>/ {0 ?( k2 g. _" D2 I1 R. z6 a
  30. #include <asm/io.h>
    4 p# Q, `5 d# }. K+ i: A2 D
  31. #include <linux/moduleparam.h>
    ) k4 G) y9 c% I! Z# C4 {
  32. #include <linux/sysctl.h>5 U. C' v# @: ]1 h" w
  33. #include <linux/mm.h>
    7 t. r, ]* B. o% ^& V! P& Y7 h
  34. #include <linux/dma-mapping.h>
    * `  R+ \' ^% F+ a$ g5 U

  35. 2 c+ ]( A+ C3 N8 W' a* {( ^; d" Q+ g" v
  36. #include <mach/memory.h>/ ^# \4 |% X/ b. y1 h; A( M
  37. #include <mach/hardware.h>1 s) Q- Y$ [$ q: `3 @  b& K! u! c
  38. #include <mach/irqs.h>6 s# K6 v7 J, D9 p
  39. #include <asm/hardware/edma.h># p: M8 i: J' M$ r7 ^

  40. 5 K/ N9 t- ~9 n! n% N
  41. #undef EDMA3_DEBUG6 \  |* {0 T) w. W. c
  42. /*#define EDMA3_DEBUG*/' ?0 ~* H! Y  l& S
  43. / v  Z& b$ j, `) m) }7 ^# s
  44. #ifdef EDMA3_DEBUG
    1 f3 W3 e8 T1 m! s5 o$ K6 _5 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* W) H' E4 Q* J% d- o. f' T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # D" c- O, C3 m% A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! W& `6 ]& \) B
  48. #else
    # b5 B4 Q/ R/ M) w( n) D/ `
  49. #define DMA_PRINTK( x... ), j' s! T4 L3 B2 {, g+ a
  50. #define DMA_FN_IN) F( M& m8 M$ X6 y. N
  51. #define DMA_FN_OUT% @7 o3 k/ A5 ]: Q2 {/ C/ u4 m
  52. #endif
      I1 P# r: y4 b$ T
  53. ) _+ Q) T$ h: H# ~; I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , @/ E2 u' [# n' h0 k, B
  55. #define STATIC_SHIFT                36 l- E( |' M+ n! B; B
  56. #define TCINTEN_SHIFT               20' S. L  R3 F: a  ~) E6 t
  57. #define ITCINTEN_SHIFT              21
    % }  y% @, x' [  c5 ~
  58. #define TCCHEN_SHIFT                22
    # I0 I( e. a/ K3 J1 P7 Z
  59. #define ITCCHEN_SHIFT               237 w* k( F+ w  U# ]

  60. ) K+ l1 a8 S& U3 u
  61. static volatile int irqraised1 = 0;
    # ^/ k& f* m# y
  62. static volatile int irqraised2 = 0;  W' S3 d$ g# g) l* m( L- @  J

  63. 2 O' z; Y' w; P' {" e0 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 U& k" t, t9 q  L, m" R+ r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + D) J, l( R4 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 x  |' f2 v& L5 t4 G7 w

  67. 1 ?# x) D; b) x
  68. dma_addr_t dmaphyssrc1 = 0;4 L6 i- }& M1 J! K
  69. dma_addr_t dmaphyssrc2 = 0;
    , E% [! D# \5 |3 t' C4 g" \. y
  70. dma_addr_t dmaphysdest1 = 0;
    7 q, \# ~# n7 a" h: L. q8 z, @9 Q1 l; O
  71. dma_addr_t dmaphysdest2 = 0;( B) q# G  v- u+ S
  72. 6 s- f! [5 N" C
  73. char *dmabufsrc1 = NULL;$ c5 z* F; Z; N4 L
  74. char *dmabufsrc2 = NULL;% a& k* W- y/ O2 m" q
  75. char *dmabufdest1 = NULL;
    ; K) u+ r1 m4 `3 A$ ?5 E
  76. char *dmabufdest2 = NULL;0 A  P$ \- m( w2 z# ^5 e

  77. ! n- O6 r  _) z+ q5 z7 |
  78. static int acnt = 512;, V5 w/ V* `1 J4 e; B5 A6 v
  79. static int bcnt = 8;
    4 l1 d+ b7 M9 n9 j; A* C
  80. static int ccnt = 8;
      s+ W* G( L' x) w- K* }- X4 S
  81. 7 R, ?* w+ v# v/ M% ]
  82. module_param(acnt, int, S_IRUGO);
    5 ~1 |: r+ V) I
  83. module_param(bcnt, int, S_IRUGO);
    / g& b' F. k1 H, H" r! s( |$ M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* i& M4 ^: Y# i% v* N
6 S- Q2 d% z1 ]8 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 u9 e/ ?& H" ^" F+ a" p0 |; J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: ?& n3 \: W/ N& `* h7 U3 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" f; W# B6 ]9 F) }
; E* f& y& m" o
* z5 r' H( q& V5 B# u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-5 01:37 , Processed in 0.040541 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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