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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " \: a' n- ], V
  1. [code]EDMA sample test application
    ) W- C; j* Y3 m+ o# [" L
  2. /*4 p0 a) q2 p, i/ d/ _
  3. * edma_test.c
    9 e" J8 ?4 |6 t( I) ~0 P- V; _' m! P7 R
  4. *
    0 T! u6 m+ ~! ^, G( I, ~* k
  5. * brief  EDMA3 Test Application3 ~# H$ a/ P0 r5 g3 ]# `
  6. *' h" T  z9 F7 c* ?5 v
  7. *   This file contains EDMA3 Test code.. ?" \- G/ _; D, f
  8. *
    , G4 O/ C' W; u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 W- r0 Y: Z8 }/ C2 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " q% l3 b3 E% u5 D
  11. *         TO CHANGE.
    9 i' `' ]' B! A- L' z6 U3 R3 N
  12. *
    * V# V! @2 }% J% j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K( d6 `" ?' `! N$ B
  14. *& s: z. w  r5 T
  15. * This program is free software; you can redistribute it and/or
    * Y2 ~- y7 o. I/ T
  16. * modify it under the terms of the GNU General Public License as! m3 V5 C5 k7 Q5 I$ A
  17. * published by the Free Software Foundation version 2.: x( o1 s: @6 e) h3 E6 h
  18. *
    5 f' j2 c/ J  f- b1 d7 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , b7 e+ s5 T) [: M3 G8 V
  20. * kind, whether express or implied; without even the implied warranty
    & v# ^: i7 h4 H$ U( O& d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 G; k( z' A1 b# B3 E
  22. * GNU General Public License for more details.
    * A; j7 M) u! J# T# `
  23. */# }; y. j  m, n2 O# Y! W

  24. ; j7 ]3 y" a+ z
  25. #include <linux/module.h>
    ' ~! l* o2 K* Y# S
  26. #include <linux/init.h>
    ( W* \& D  ~' r% ^" _
  27. #include <linux/errno.h>8 q! q' u5 j# ~" D9 S0 A6 Q
  28. #include <linux/types.h>' w& A0 o  d: p2 e$ u8 N0 y( h. k
  29. #include <linux/interrupt.h>( p1 k, `7 m, o3 Z2 z1 N' r0 R$ C
  30. #include <asm/io.h>  o7 }4 w8 }# W! d
  31. #include <linux/moduleparam.h>
    + n: Y! W! m" b+ s, n* f5 s
  32. #include <linux/sysctl.h>
    ! W# N( B* M3 ^  P( W! T
  33. #include <linux/mm.h>+ i! ~1 M; J, }3 h% Y  P
  34. #include <linux/dma-mapping.h>
    0 q% _3 y* [' C$ l5 Q1 N& q

  35. 4 }9 o. P& p% B" U- u7 ~/ }2 Q: v4 v1 l
  36. #include <mach/memory.h>
    . B# P* j/ ?* w" A  h3 t4 T9 S
  37. #include <mach/hardware.h>1 ~: x7 }+ K1 b6 S* @8 L
  38. #include <mach/irqs.h>9 j' k+ o, O$ Q# Q. E( f* I& O
  39. #include <asm/hardware/edma.h>
    2 F2 Y$ i% `! ]' c
  40. 8 S+ N, k8 ~" z, c, F6 J4 `3 w
  41. #undef EDMA3_DEBUG+ A& |7 \+ l* Q) M% y4 _
  42. /*#define EDMA3_DEBUG*/. m0 L3 o# G; G. L2 t' c

  43. $ v  r# i7 W" p) e1 H) w' O3 p
  44. #ifdef EDMA3_DEBUG
    ; }6 n/ S7 T  @2 q  p& I( m1 H7 Z2 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- G: N- P" N6 f- r' F) z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 `% D% v: s) h1 ]+ F9 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R% l  l- U8 r3 \. N, f
  48. #else' W3 q- l8 z$ r5 e; F  }4 |
  49. #define DMA_PRINTK( x... )
    9 U5 r# A0 n/ |6 r
  50. #define DMA_FN_IN
    5 X0 C/ N2 n; b
  51. #define DMA_FN_OUT
    ! D3 B- K1 Z1 s9 A3 T6 ^
  52. #endif
    . N8 S6 O2 R7 y5 C

  53. & ?$ p8 F2 \/ N- y# d0 I7 W! t# a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). Z  O) n8 y( ?, d5 n6 z
  55. #define STATIC_SHIFT                3: O) g7 n  @0 C
  56. #define TCINTEN_SHIFT               20
    5 _+ K8 }! _( [+ `  b6 [. ]; ~
  57. #define ITCINTEN_SHIFT              21
    - x% m2 z! S' i" _# `
  58. #define TCCHEN_SHIFT                22( S6 N& W# O! A7 @
  59. #define ITCCHEN_SHIFT               238 k- Y+ T; ~6 Y0 s3 S
  60. 7 C( Z% S. q, L3 P
  61. static volatile int irqraised1 = 0;/ C2 V! t; Z/ P( p1 z4 g# c
  62. static volatile int irqraised2 = 0;  z4 q" J2 h7 {/ ^; K8 o7 e: h8 P% V
  63. 1 a' [& q+ {2 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K) j( g1 H& b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 u; u2 y$ \3 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; L1 \; g' e- z/ q9 t
  67. ! Q. O2 G* ?' I# }
  68. dma_addr_t dmaphyssrc1 = 0;
    8 w/ `5 N+ E5 n8 w! N8 R1 t
  69. dma_addr_t dmaphyssrc2 = 0;+ F7 N) b0 W/ E3 S0 d, Q3 a
  70. dma_addr_t dmaphysdest1 = 0;$ j, T6 o# L( X; S/ ~
  71. dma_addr_t dmaphysdest2 = 0;7 E0 c# y3 w* O2 [4 K
  72. 5 F) C6 v8 M  u8 \) a3 E
  73. char *dmabufsrc1 = NULL;% Y0 P+ I+ T/ ~6 F0 D
  74. char *dmabufsrc2 = NULL;6 g3 L' h8 i' Z; Z0 @2 u3 O
  75. char *dmabufdest1 = NULL;
    % x, J6 P8 o% k
  76. char *dmabufdest2 = NULL;  A, f: V" m7 N$ Y9 m; w8 h( h
  77. 4 m" y3 e/ w. M- w$ n1 W1 I
  78. static int acnt = 512;
    & h$ ~; ?0 |; _8 s2 v$ h
  79. static int bcnt = 8;# g) c* ~1 C' B1 V9 s
  80. static int ccnt = 8;
    6 H6 \$ q* U' r, ]# K! U
  81. : x  Y# H# t5 c; m
  82. module_param(acnt, int, S_IRUGO);
    # L# B5 S- m9 ?& i
  83. module_param(bcnt, int, S_IRUGO);! Y7 |; f3 B* R5 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: M! ^, o1 i+ I5 r9 T- R9 b/ z4 R6 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 F9 I2 \$ v  K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) F9 q1 q* m0 _' D9 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 @; U5 l  i' z6 H5 v
4 E7 w7 |: e1 u3 A

  A: e$ }( q- j& i" g4 ~! O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 11:36 , Processed in 0.046662 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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