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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 w/ N4 ?; Y. O' s
  1. [code]EDMA sample test application
    ! o9 {& ?6 P' x4 b/ m1 k
  2. /*
    ' e, N* q! Z6 l/ r  N) ?: X5 j
  3. * edma_test.c" D1 S9 V  \. j" o6 t1 j$ [
  4. *
    8 ^8 U' J6 v9 ^/ D  s
  5. * brief  EDMA3 Test Application9 W, y$ k1 S; F! N8 s
  6. *# J0 R; g, X4 q+ `/ T, Z2 @& s
  7. *   This file contains EDMA3 Test code.1 Q. P, t& K7 Z) l0 X
  8. *
    $ s5 n" r  E5 M6 x; D8 z/ J, e  \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' }- V5 X) f- A* i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 d6 d% {% [' h
  11. *         TO CHANGE.
    ; D% b8 O  [9 B+ l
  12. */ l/ m4 h$ G/ q) y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 L, R* A5 F& \5 U5 l6 A# y
  14. *
    9 C+ {1 O" Y; G' D
  15. * This program is free software; you can redistribute it and/or/ e# U& y1 }1 u( I+ n& o+ s/ ]* I
  16. * modify it under the terms of the GNU General Public License as
    3 ^+ J1 L3 _, s7 {4 t% I; C
  17. * published by the Free Software Foundation version 2.; a7 I: [0 R7 [' @
  18. *
    ; ~: e; A: }5 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + u) E2 N6 l( e1 `
  20. * kind, whether express or implied; without even the implied warranty  b' H% ~1 |! k3 b, r6 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* S& E+ b, w0 ]
  22. * GNU General Public License for more details.
    5 k7 r) w0 G* [7 W
  23. */2 I2 ]# c8 v6 V( r

  24. # I1 }# g+ N# n+ ~( Y
  25. #include <linux/module.h>
    & U$ I, @' s$ @4 {) d5 \4 a
  26. #include <linux/init.h>
    6 A" R2 B. \' y1 e+ E+ y$ l# b" _
  27. #include <linux/errno.h>
    ! M! R+ |2 N3 _; R
  28. #include <linux/types.h>
    ! k* J# l9 m) O+ I& T! J  P
  29. #include <linux/interrupt.h>: c2 H0 ]1 u+ C4 z0 I" s$ \
  30. #include <asm/io.h>
    + Y0 E7 _* N2 E9 k  d
  31. #include <linux/moduleparam.h>' j; t; J' I) Q5 \
  32. #include <linux/sysctl.h>! H# [! V$ s0 x: t
  33. #include <linux/mm.h>
    : R1 `2 `" K, e5 r$ Y$ g: ~
  34. #include <linux/dma-mapping.h>
    , a; K) I$ g. o  X* O8 Q7 q

  35. & f& B  A: j3 b+ z! ?$ U
  36. #include <mach/memory.h>
    , g4 m; w. l/ Y1 i2 U+ H- d" }$ h
  37. #include <mach/hardware.h>; a6 C4 V7 ]/ Q: u3 s
  38. #include <mach/irqs.h>
    : P) f, F) H7 f! B4 o# ?6 P4 g
  39. #include <asm/hardware/edma.h>
    " S1 L. v4 U: n. Y5 A

  40. % K) n" b- Y3 K5 }1 [$ J  G0 q
  41. #undef EDMA3_DEBUG. w4 G1 }- o0 f9 r4 A/ R# Z" y
  42. /*#define EDMA3_DEBUG*/
    ' [) `& P' R* A/ M2 L
  43. ; q) N! T% d0 |7 x# r) }- Y
  44. #ifdef EDMA3_DEBUG
    2 r, f, ~: E* ]- a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 q: e0 _! i2 z" t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      T; j: T7 ]% b; e& y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' S' ~( g4 y1 u, Z9 @7 k
  48. #else7 m8 x6 }$ d0 ?7 W* [( p5 c
  49. #define DMA_PRINTK( x... )4 c# p6 x$ f1 B. k  z
  50. #define DMA_FN_IN
    3 n) i% G5 t3 W. q& Z1 f* V, [
  51. #define DMA_FN_OUT& @1 G3 `8 B0 X( {* A$ @. q5 h
  52. #endif! u& v+ K6 X  U: O
  53. * F& C4 P' ?- R! c, F% p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 O) k& t# ^, }5 s
  55. #define STATIC_SHIFT                3
    7 U0 l$ f+ c6 m- h! S: W" U! S
  56. #define TCINTEN_SHIFT               20) r- Q# u7 O8 Y/ [) i
  57. #define ITCINTEN_SHIFT              21
    ! ~( c# N; ]( m' P% W9 h
  58. #define TCCHEN_SHIFT                22
    3 O, h; Q5 C- _5 i4 w0 X+ B
  59. #define ITCCHEN_SHIFT               23
    / b0 d4 f! D& L# U( u( {" m. B; O

  60. 1 h$ d1 |. [) B
  61. static volatile int irqraised1 = 0;$ M- k# F3 g3 ?4 I: W  U9 s/ @9 O
  62. static volatile int irqraised2 = 0;: d. M4 f8 K0 X% _5 O6 U
  63. # D# Z" G3 U1 `! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , j, I0 n, l2 f  Z# X8 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 g: `' j% A1 w* S, K- Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 A6 D' }# F# j/ Y, r/ U
  67. 6 _8 I. N0 |. S6 H. T
  68. dma_addr_t dmaphyssrc1 = 0;% C, h9 F& l, y" w% A( I
  69. dma_addr_t dmaphyssrc2 = 0;7 X, ?4 a- b, y- v8 s' |$ y6 q
  70. dma_addr_t dmaphysdest1 = 0;
    0 r/ e( ^# `+ H4 [# w3 R! Z
  71. dma_addr_t dmaphysdest2 = 0;4 G3 C: a& p0 ^" k& ~: }

  72. 5 B% {- F! |4 H. B
  73. char *dmabufsrc1 = NULL;
    6 x4 [6 v% ~7 ^1 |5 Q
  74. char *dmabufsrc2 = NULL;, D4 a0 ~) c) ^7 U
  75. char *dmabufdest1 = NULL;: Y, ]# o7 ~+ U9 J! Z
  76. char *dmabufdest2 = NULL;5 n) a! I1 T- o7 l/ L# \7 z0 P
  77.   A6 r5 g4 Z$ J1 ?- G6 v
  78. static int acnt = 512;5 O$ T: o2 \" t% o
  79. static int bcnt = 8;+ r4 e2 M9 P+ h; R& \) O6 Z+ S5 ?' o
  80. static int ccnt = 8;
      W& I: A8 U' q2 i8 D+ ?- V2 q
  81. 1 J- b# v% h& H! o! E# v+ d
  82. module_param(acnt, int, S_IRUGO);
    & X# q/ K: T/ U8 p/ `2 ?
  83. module_param(bcnt, int, S_IRUGO);
    " M+ g, ?9 g+ j. s# f- Z2 ]) X/ O& Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 R) j0 }- t7 m0 M1 F7 o! L4 y# y7 U" ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ u+ `$ g7 Q8 X5 Q* e5 v$ B1 {; Y) P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* G5 y5 u4 e  F; ?% t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! y8 C( S4 p4 M& _  W- u
6 S+ k9 a3 T5 k! ?$ X1 d# i5 e2 \" r
; Y2 r( E! V! q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 11:25 , Processed in 0.043872 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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