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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! j% f7 s7 Z% x( v$ s
  1. [code]EDMA sample test application8 E( ^: L" D! Y) x1 T6 d
  2. /*
    2 K' ~! @, {4 ^- b6 B
  3. * edma_test.c+ `3 {% V6 L) R" `8 w7 a8 o; \
  4. *% X" ]: I5 v  t0 D6 p  @+ b7 f. x0 c
  5. * brief  EDMA3 Test Application4 F2 W) P2 E4 U/ z9 r
  6. *9 d7 H! y( J5 e4 X# K- s
  7. *   This file contains EDMA3 Test code.
    $ C$ q; o& P3 s9 s% O' F
  8. *
    1 f/ w9 j. R* f& t# ]' M5 u1 Q( v; F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q2 W0 c' ~1 }( D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" q8 Y7 O6 t8 i5 w+ o* b; x# E
  11. *         TO CHANGE.
    # \+ `5 `) H. b) b. W% x
  12. *1 a: q; v) T$ k: _7 M7 T$ f+ E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % n8 ]5 M* Z  D  r5 Z
  14. *
    2 g4 k! S1 G; j0 P5 B
  15. * This program is free software; you can redistribute it and/or
    6 z& J5 `( j  s& x
  16. * modify it under the terms of the GNU General Public License as
    . x! W+ r1 T) W  v* l: H
  17. * published by the Free Software Foundation version 2.2 t* _, o3 K" Z% q* P9 U9 G8 r, Q5 w
  18. *
    6 Y% y2 b2 _( ~* p& B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' U) D# @* q+ }+ \3 n* w  @
  20. * kind, whether express or implied; without even the implied warranty! i, E" _. o, w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, \1 D3 q* [- ]; H# v$ C; V  e) g
  22. * GNU General Public License for more details.8 c- W- g* o0 k) i$ L8 v1 C" F8 {
  23. */
    1 N$ x) X* D5 f8 B, ~

  24. ' c4 L; `' w4 C, A
  25. #include <linux/module.h>
    ! R  e3 d+ T# a) c
  26. #include <linux/init.h>$ r" g: b  H) @
  27. #include <linux/errno.h>
    * W# L7 U. q$ c) J" e
  28. #include <linux/types.h>. s, Q/ {8 P( T6 F, a; Y  t2 q
  29. #include <linux/interrupt.h>
    & B3 a8 _) H. U+ @! @
  30. #include <asm/io.h>7 B4 s' b7 P, G' \  F
  31. #include <linux/moduleparam.h>3 t5 J. Y* g$ s
  32. #include <linux/sysctl.h>$ h; g' z) ]0 V) w9 i
  33. #include <linux/mm.h>- o+ R; E6 |; `0 A  p( i: L
  34. #include <linux/dma-mapping.h>
    : J2 K  W7 k/ Y" O

  35. 0 e- _7 u5 V/ V" S- R+ E7 b
  36. #include <mach/memory.h>4 e7 G6 c8 n$ i; N
  37. #include <mach/hardware.h>; }" w4 X" h. p
  38. #include <mach/irqs.h>( `+ J, I- J7 B5 J
  39. #include <asm/hardware/edma.h># M3 _( B3 |& L2 v2 P

  40. 7 j5 N+ C7 l; J8 p5 @9 @+ Y" [: M
  41. #undef EDMA3_DEBUG
    4 l( C; P; A: j  [2 N% Y% l
  42. /*#define EDMA3_DEBUG*/# A. B2 }$ \: s; v, K9 s

  43. & V  q' {6 H2 D, I4 I% l& {! ^
  44. #ifdef EDMA3_DEBUG, @; f# x  s9 o5 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 [) r; P0 s% G' o7 \  ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * N7 P! N5 G  g9 u* S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 F8 N- Y: K7 @/ [& B, i/ W) Y
  48. #else+ j8 H& ^3 {! s2 }6 F
  49. #define DMA_PRINTK( x... )
    ' \4 z0 m9 [6 ~
  50. #define DMA_FN_IN. J2 P- W8 x6 v# s
  51. #define DMA_FN_OUT
    ( D" T3 y0 \( f% Q+ d, c% I
  52. #endif, H/ ?) C( |. e7 g) n: [

  53. ! y. O5 U2 O6 d: \7 _2 u. ]- Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 V/ X- p3 k9 n# i) i+ ]
  55. #define STATIC_SHIFT                34 `# |) d' c0 p) P, ^! w2 m
  56. #define TCINTEN_SHIFT               20+ U/ f9 c( t7 h% ?4 M, O3 W
  57. #define ITCINTEN_SHIFT              218 R6 _% l7 @7 B6 H4 f9 c9 {
  58. #define TCCHEN_SHIFT                229 l5 Z& m- p5 C
  59. #define ITCCHEN_SHIFT               23( N  ^0 f4 V7 S

  60. . b+ H9 w- }: w4 s
  61. static volatile int irqraised1 = 0;
    # T% C/ l' c, x! Y: G
  62. static volatile int irqraised2 = 0;! Z( L6 A6 s! _. t! b. G% G/ @

  63. $ f' `% ]* o2 Z; Y: o7 v; l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & D4 u3 B* ^  y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L  z) h% ]% k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  P  T' a. S5 \4 U( W! l3 t

  67. . |( G% n& t& D; T; Z
  68. dma_addr_t dmaphyssrc1 = 0;
    ( d2 [: }' ?! j3 L2 F
  69. dma_addr_t dmaphyssrc2 = 0;
    " n. D" ?; P% r$ F) p3 S$ C! b% E
  70. dma_addr_t dmaphysdest1 = 0;
    , \* O5 @; ^3 ]
  71. dma_addr_t dmaphysdest2 = 0;, g+ {& C; W3 b' q7 I
  72. 0 [& l4 i. P) n& p2 g; o; w
  73. char *dmabufsrc1 = NULL;8 Q- a* t1 R2 P* |# @% m3 J( s
  74. char *dmabufsrc2 = NULL;
    . O+ i/ J( Q+ I2 e* k7 y
  75. char *dmabufdest1 = NULL;/ W; Z- f$ ~5 ^+ c5 y
  76. char *dmabufdest2 = NULL;
    , u$ ^, ?, W2 d( Q+ \5 y
  77.   n, Z8 _  y/ u3 z
  78. static int acnt = 512;6 z2 G  w+ \& }# h$ G
  79. static int bcnt = 8;1 h7 l' D/ a# q- x! A" H- r2 W: A
  80. static int ccnt = 8;
    . A* M2 Y9 B, |# U! x" w
  81. * ~. c  x. n/ Q% w6 W
  82. module_param(acnt, int, S_IRUGO);- O) d9 t0 K4 z$ H) `7 P- G
  83. module_param(bcnt, int, S_IRUGO);" u- X% |5 S7 \1 C1 U+ s& T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 Z7 G: U4 V" H, [9 l
- ]: v3 y9 G8 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, f; F4 l! s! K6 n: l8 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 m- m) B9 _5 d+ b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  g5 G/ }( ]: C
2 v8 }, _! |. Q  f% i8 a5 ^( D* q$ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 12:41 , Processed in 0.040282 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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