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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, [& I+ w& m; e5 [! ~  S% k9 V+ l
  1. [code]EDMA sample test application2 r/ O3 @8 Y7 i( d' }& x
  2. /*( u& y. g% `  D2 ], r1 W8 u
  3. * edma_test.c
    8 ~) |, l- m8 }7 p, V- a- x
  4. *
    ! u9 b+ S5 O& O7 W' C: D
  5. * brief  EDMA3 Test Application! P: Z* O0 ?" Q; w: @
  6. *
    . _; {+ z, k4 }! D# x
  7. *   This file contains EDMA3 Test code.
    4 I; j* ]$ j$ J. O8 _# X2 j* p
  8. *: n+ @' G5 L, t2 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ E4 z& z% `: Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 `" w; Z  n% l! o/ e
  11. *         TO CHANGE.  w1 X. E0 j' C2 f
  12. *2 u( C- P9 ?3 \( p: g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 W- t+ \' D3 T0 d, G; g( \  i( S) g; ]  Q
  14. *
    " @( u* p. J9 x! n: Z' ^
  15. * This program is free software; you can redistribute it and/or
    $ L" `' D. }7 |9 |
  16. * modify it under the terms of the GNU General Public License as* p, ]. Q5 z8 m0 d- v/ A; o
  17. * published by the Free Software Foundation version 2.
    2 T- p) G- L; i, M8 I
  18. *
      p6 K7 Y8 D0 U% M" n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 B, S5 M% A* ^
  20. * kind, whether express or implied; without even the implied warranty
    . K2 O" B1 }0 y8 c7 [+ ?+ A$ J; \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & \- ~* v( ?' _" l3 d9 D
  22. * GNU General Public License for more details.
    - o1 ^! y: r- V
  23. */5 @0 ^: y1 Y2 Y3 z
  24. , a; t+ B- X& p7 |$ q
  25. #include <linux/module.h>
    2 `' C, ^% J  o+ L3 d4 O
  26. #include <linux/init.h>: D' ]2 E2 g; ^9 Q
  27. #include <linux/errno.h>  y; f7 P2 K. s5 Q2 J. k
  28. #include <linux/types.h>
    & \) [& G0 I: R# @
  29. #include <linux/interrupt.h>9 H/ W" J# p! m1 V  c& h2 \' C  |; [
  30. #include <asm/io.h>6 O" s* i! g8 i$ Y2 w) L+ H5 r6 G
  31. #include <linux/moduleparam.h>! w" d  @, W) g* Z3 }
  32. #include <linux/sysctl.h>4 Q: F. K  r% c; O3 ?; i
  33. #include <linux/mm.h>
      t& j. S8 ]+ K( g
  34. #include <linux/dma-mapping.h>0 c0 B( ~1 G, V. ]3 o1 x% b$ ]

  35. ; U0 Z" s. g1 W  U
  36. #include <mach/memory.h>
    * l5 `" }! K" J0 Z7 D  d5 L% O
  37. #include <mach/hardware.h>; W. u7 g( F: v6 F* R" {
  38. #include <mach/irqs.h>
    # r9 K7 h0 X) u4 T9 y* U3 v$ `
  39. #include <asm/hardware/edma.h>2 O" \& G' Q) b" [5 y7 [* d

  40. * {' X! ]  a$ n3 L# |+ \& d) G+ Q
  41. #undef EDMA3_DEBUG
    8 T' S: r  F" A: w
  42. /*#define EDMA3_DEBUG*/
    . {$ Y# }! H& N9 ~
  43.   @. `9 q  E  ~) Y7 i6 D
  44. #ifdef EDMA3_DEBUG
    % g/ `' j* @! z8 K; P0 b# K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 `: C& P9 B" n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 H: q" r' x+ e; H. w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , M3 ?  L& ?, }2 V
  48. #else8 f+ L7 H% |6 F" D* v- f. K
  49. #define DMA_PRINTK( x... )& \4 r+ f7 j1 X$ k
  50. #define DMA_FN_IN- s7 h; L$ }0 X5 o- y/ A5 G
  51. #define DMA_FN_OUT
    ! ^- _# s' {5 V0 g' h
  52. #endif
    5 V- v9 C7 ^9 E% f' w7 |0 W
  53. 1 d3 n+ V+ N0 [: K" d1 ^. B9 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 R0 ]1 Q5 i& I$ ]* T1 F
  55. #define STATIC_SHIFT                3
    - p3 N$ P, F. ?* Y" f. Z' o
  56. #define TCINTEN_SHIFT               206 I7 U% ]9 b# f2 k: W) H7 Z
  57. #define ITCINTEN_SHIFT              214 S! `: ^' A3 c  P2 V. }! c
  58. #define TCCHEN_SHIFT                22
    ! r. {- T0 p8 v8 S& U8 n: z
  59. #define ITCCHEN_SHIFT               23
    * x: _9 S( V9 p) M" t4 I3 c0 Z6 E
  60. : ]* Y' r3 e* l4 c9 {% {& K+ i0 [: n
  61. static volatile int irqraised1 = 0;8 P/ e) m. n; u% U, F1 I
  62. static volatile int irqraised2 = 0;
    ' }! O9 g6 ~2 {4 H  W

  63. 0 c/ R7 F, {" s" u" H6 Z3 S+ T0 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " a3 k' n4 x; f0 _1 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k% r% |4 l5 Z4 h5 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J# A/ l1 C% M# P) m
  67. 7 V$ R' U' \$ p& h( C+ |$ e8 W
  68. dma_addr_t dmaphyssrc1 = 0;
    " I: ~% R1 i. m+ K' I8 P
  69. dma_addr_t dmaphyssrc2 = 0;* M! t0 n( O# m3 K
  70. dma_addr_t dmaphysdest1 = 0;
    : k: f7 T$ Y/ W+ ]- V
  71. dma_addr_t dmaphysdest2 = 0;
    " G  t! p6 Z% s- ~0 L0 ~

  72. . q; i6 R8 a0 \" q9 q
  73. char *dmabufsrc1 = NULL;
    - ~0 U5 s$ b7 t! {" o( n/ I
  74. char *dmabufsrc2 = NULL;& K9 X6 H! b! s) e+ q8 Q
  75. char *dmabufdest1 = NULL;8 z" X" B, I& F' B# u+ n4 _2 i7 `
  76. char *dmabufdest2 = NULL;2 o% d6 U+ e. i  A9 @
  77. . y0 ]- \4 T( p. e( [' h! Z
  78. static int acnt = 512;5 p' _3 T7 ^7 G. T/ K$ Z" p! a  ]" c* B
  79. static int bcnt = 8;, J9 s  ?0 R9 n/ d0 A+ p$ u% R
  80. static int ccnt = 8;* E+ m  E0 w7 r, ]" {
  81. $ `# A1 O# k0 t& i2 X: c+ G
  82. module_param(acnt, int, S_IRUGO);
    6 ?! i" U' s& q- P0 f
  83. module_param(bcnt, int, S_IRUGO);2 h- c) i1 Z: d' X+ q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 f3 Q% ?8 L* ~4 D" p  F! A
, ~7 d* e  J2 o6 i2 u' ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ~' @2 b2 ]) _( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 S" b/ y# V4 W& h+ M' |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; E7 T3 W; C( {( T) A: I# v

3 N( N) I1 g+ t  }4 X, G8 r
" \& E0 m6 n' ^" n4 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-10 13:22 , Processed in 0.039251 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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