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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ]+ |7 P8 S: e: f* R8 U
  1. [code]EDMA sample test application, R: {) W% L  d% q
  2. /*2 x  x! q, t5 Z8 ]7 V. P6 D/ x
  3. * edma_test.c
    5 u7 l  q1 i8 w- l3 l
  4. *
    $ H; \: _+ h) U  f  l# O# i. R
  5. * brief  EDMA3 Test Application
    0 W/ b9 R5 j; W( E: n0 w% N: {7 j
  6. *
    # {' l* T6 v3 b: X( S; G
  7. *   This file contains EDMA3 Test code.* o8 {: W7 D9 t3 @; ~
  8. *  t8 ~6 N* X. R4 c) b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 F2 y, E' x7 e5 x% C/ z) k  |& z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 q; y4 ^1 s0 ]0 _4 p6 d  i$ o
  11. *         TO CHANGE.
    7 s& }+ x% B$ I3 c) R
  12. *. X# V  h: D% y/ [) v6 E4 X& e. Q2 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; T* ^! X# i! o$ R3 }/ O# ^6 T
  14. *  C' \, w2 r% j4 N& x
  15. * This program is free software; you can redistribute it and/or
    ; H) S8 a  X! W, m5 p
  16. * modify it under the terms of the GNU General Public License as5 X: b. y3 O/ P
  17. * published by the Free Software Foundation version 2.4 Z' R  n' n4 z
  18. *
    9 w0 {) w/ Y, o1 i+ z1 M' z" i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - \, |) r+ u  H9 b9 F
  20. * kind, whether express or implied; without even the implied warranty& f: @' l, K7 O# B4 U( F' Q( b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ ?/ y! H( J: b  n+ o
  22. * GNU General Public License for more details.
    ( M0 N4 d2 K9 L# Z$ i
  23. */; o% C% g/ r4 X" N8 c! A
  24. 7 ~) t$ f% a1 c4 \4 K4 E, n( V& H
  25. #include <linux/module.h>
    7 i+ c0 }: X  j
  26. #include <linux/init.h>8 A( ~8 f6 c: v9 z
  27. #include <linux/errno.h>
    : f, z8 W& |: ~7 k% g) ^
  28. #include <linux/types.h>9 H, |4 T" p1 F: m4 T
  29. #include <linux/interrupt.h>
    7 O9 h. s, b* x9 |
  30. #include <asm/io.h>
    : n- a1 w! b) S* l1 @  U
  31. #include <linux/moduleparam.h>) r% R) S, L6 Z) X
  32. #include <linux/sysctl.h>$ V/ R$ u1 N0 z8 C! L" P" e1 h, m9 H
  33. #include <linux/mm.h>0 r% g" `) C; ?5 ^% |
  34. #include <linux/dma-mapping.h>: G6 x6 W7 P$ R
  35. * |7 `* Q3 e! `* ~: t" W1 E
  36. #include <mach/memory.h>
    - I' L% U3 |, a- j
  37. #include <mach/hardware.h>
    - k( P/ P0 v  g$ Y9 Q
  38. #include <mach/irqs.h>: [0 W5 a7 V! ?$ R5 W( M
  39. #include <asm/hardware/edma.h>
    ! r. [# q0 R7 x

  40. & I6 e% r5 \3 H7 A  U5 y
  41. #undef EDMA3_DEBUG6 x( \2 W* o( O, b$ f/ F* q0 n
  42. /*#define EDMA3_DEBUG*/6 x$ @+ U1 \  f6 _! z  @

  43. & H) l* r/ `$ \  \, e
  44. #ifdef EDMA3_DEBUG& @# D) J2 f/ B6 {: D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# n% Q  _" ~; A2 ~/ g' M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - `) k6 w9 a) R( p: w5 J! ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : i7 b, D& c6 V
  48. #else, x& O) k% k% k
  49. #define DMA_PRINTK( x... )' Y) [& \% h7 Q7 O: ~
  50. #define DMA_FN_IN2 V  K* X/ ?3 R' R
  51. #define DMA_FN_OUT
    8 F$ u' @- W) Q% F* S' ]% V
  52. #endif
    3 J- H/ _  U" _, ?  i
  53. 9 |' d# a1 C. a! I/ K% z" a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( f: D! G! o+ @: m  U9 b
  55. #define STATIC_SHIFT                3
    + k& {/ i3 A5 \( z$ [' x
  56. #define TCINTEN_SHIFT               20* H- \, T. Q" _: Q, g
  57. #define ITCINTEN_SHIFT              219 ]# P" b5 V. m( g8 @
  58. #define TCCHEN_SHIFT                22
    " X3 a! P5 L6 d% j
  59. #define ITCCHEN_SHIFT               23/ [( D* @& G3 e$ o* B! p

  60. " F* @  K# g( P; A) K
  61. static volatile int irqraised1 = 0;
    3 T- u; [  ^$ l, O( ^
  62. static volatile int irqraised2 = 0;, D* A+ s0 \, |' r7 Z" i3 J
  63. # g  q. C, |: D# t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i! c( ^6 f# R) B, a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , u* f& Z9 \( n# P0 E2 R8 I$ W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k. K! H/ R- W, m5 ~+ T

  67. & D  y3 T5 N! Y, G  I- S8 p
  68. dma_addr_t dmaphyssrc1 = 0;% h; g, @# [2 ?$ X
  69. dma_addr_t dmaphyssrc2 = 0;; Y' v1 I* r' N
  70. dma_addr_t dmaphysdest1 = 0;
    " s5 Q2 ]$ C, g/ o
  71. dma_addr_t dmaphysdest2 = 0;: Z. ?. Q0 D5 R7 W2 ~. o2 h
  72. 9 n: T% w7 _- G
  73. char *dmabufsrc1 = NULL;  _& O1 a: v+ E9 K2 d: m) n+ M7 E
  74. char *dmabufsrc2 = NULL;  T/ o1 U3 g# j) ^
  75. char *dmabufdest1 = NULL;: D+ F' t& w& Z+ l! C. W! x& h
  76. char *dmabufdest2 = NULL;# i, I0 ~# u1 H0 D' c
  77. 5 r* B! v/ b/ x- }9 _7 L2 C  v* ]! W
  78. static int acnt = 512;! o7 C5 A+ j  u9 @
  79. static int bcnt = 8;
    7 N/ P7 k" Y5 o  p: n- N5 I3 ]. y4 R4 N
  80. static int ccnt = 8;
    1 R! |- P6 y( N' w" H
  81. 0 d) K+ z3 T% X* S9 T
  82. module_param(acnt, int, S_IRUGO);
    % {# Z' E2 \5 T- e: K
  83. module_param(bcnt, int, S_IRUGO);- G9 M4 W% u. z2 n0 p$ u; M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  }$ @4 x5 Q. c2 j7 y+ a1 D

* E8 L, n# i, ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 E8 \. F9 G: g5 J1 V1 D$ ?: m2 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! i! b& j4 Z6 k$ K. @; U& t$ T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, L  g0 W/ ?1 j2 i. S2 {, r8 _0 [
# p9 s2 p. D$ K' {  u9 v% f' f" \. u* e5 m1 {  q6 M0 _1 R& r+ H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 03:19 , Processed in 0.044587 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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