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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 N/ ]( [4 P/ U
  1. [code]EDMA sample test application
    ( V- c+ k$ y8 ^
  2. /*
    4 R' g- b- J2 y( X, Z! }
  3. * edma_test.c( O! Z& H$ @/ L/ ]+ l
  4. *0 X3 f2 D* G* U; I
  5. * brief  EDMA3 Test Application  `9 P* K# h: o5 f+ v
  6. *  n" ?; i3 k0 j& p1 _1 O. @7 r4 O
  7. *   This file contains EDMA3 Test code.2 R" ~  t( J* q6 {8 Z
  8. *
    9 A# F$ e# _- T+ Q; |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 C6 v$ W- O7 G" c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ M  W# U$ Y0 ~/ E, T; W
  11. *         TO CHANGE., s6 Q0 S' Y4 I: B
  12. *. k$ t! A. j; r6 w% t4 s2 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# X3 p; b9 A- j6 B. K
  14. *
    ' Q. g* v" n3 F, O
  15. * This program is free software; you can redistribute it and/or
    8 T8 J! Z8 \- {% p
  16. * modify it under the terms of the GNU General Public License as
    9 y* D/ f5 s# P+ A* `
  17. * published by the Free Software Foundation version 2.
    % O; q5 N6 P4 z0 {+ V  m5 r' M
  18. *
    # L6 T4 u% p  f; d. a5 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! E$ }& R& t  L( n7 o9 s. ]
  20. * kind, whether express or implied; without even the implied warranty0 D, |9 l5 [9 W, s# J/ i- c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 S* ~4 y- S/ v
  22. * GNU General Public License for more details.
    , W8 w! Q' g4 A8 Z
  23. */  y0 }, j1 k4 j' q' ?# U

  24. ' Y2 V: i: O; ^5 ^- J; C4 i
  25. #include <linux/module.h>
    ( a, @: e$ [1 r$ L3 k/ @4 C8 ^1 n
  26. #include <linux/init.h>
    % l9 L: W, X9 h; r1 d6 V* U! l7 K
  27. #include <linux/errno.h>
    - L: g) ~! |5 ]6 D- H5 U
  28. #include <linux/types.h>! V3 d2 p8 b/ s7 n" G" P; _
  29. #include <linux/interrupt.h>9 }' P# T5 J6 A7 ]; Q, u
  30. #include <asm/io.h>3 _  f# Y: k- R
  31. #include <linux/moduleparam.h>" Y1 I' v) N" X% @7 W, `6 |# q
  32. #include <linux/sysctl.h>
    9 y! ]) T7 y7 ~9 A. A; I
  33. #include <linux/mm.h>: @1 c- @; L* X, Q9 h5 y' d
  34. #include <linux/dma-mapping.h>
    ; V! p7 x) A/ D1 m$ N
  35. * i. `% v: }: S: f( l/ g
  36. #include <mach/memory.h>4 T6 F! r0 a% K: [6 H
  37. #include <mach/hardware.h>' p$ P! q8 j: ~" l" E8 d
  38. #include <mach/irqs.h>
    3 N2 j. B/ x, Z; q& n' J
  39. #include <asm/hardware/edma.h>
    ( O) V4 n7 E) _, ]
  40. 2 |$ r; L4 o! ^% w, N2 T4 C
  41. #undef EDMA3_DEBUG- X) S' B; {, d  V: I3 q% f9 U- O
  42. /*#define EDMA3_DEBUG*/2 x2 v" [) D# m! O+ s& ]. i

  43. # w! n5 G/ a. W. k+ T9 s0 K* F
  44. #ifdef EDMA3_DEBUG
    2 L. R3 |# M: K: |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* V$ @7 E/ N' ]  X9 q  b2 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 A9 x/ o$ Z. o: w( @% @+ H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 E5 D4 }$ r3 H; `% N: ~
  48. #else5 A2 [- M0 m5 n' Z+ g& m5 j
  49. #define DMA_PRINTK( x... )
    4 ]) {; W6 p9 a
  50. #define DMA_FN_IN& A: H8 Z" O! B# B8 n
  51. #define DMA_FN_OUT
    4 t& h! D4 K9 D. |; e. ^' @# q
  52. #endif4 K" X4 F4 H. k, X4 l
  53. - U2 U3 x1 B: E& [' K+ v+ Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & P& ?7 t# Y" f" h/ }0 k
  55. #define STATIC_SHIFT                3$ A: J1 Z1 H/ x& e; ~7 u
  56. #define TCINTEN_SHIFT               200 o% [4 N" j8 T) k' J, s
  57. #define ITCINTEN_SHIFT              21
    , ?" `/ z( V% ^% D2 m% j8 H+ U
  58. #define TCCHEN_SHIFT                222 L3 ^3 \: a9 g( }! l
  59. #define ITCCHEN_SHIFT               237 h9 K0 G6 O1 j0 s) T
  60. 1 U+ Q# A( i) Z3 f7 |
  61. static volatile int irqraised1 = 0;8 c& h. |2 b/ `
  62. static volatile int irqraised2 = 0;) j' H; p2 w" m- T: {
  63. ! b; {% G( O. u* O" e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 B1 D/ [1 X* {3 W5 }+ ]7 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 R: M+ J4 B: A  I; c! B7 \" C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v  |$ w, A* a7 D) S8 N; [
  67. 5 D) l' G, X  `
  68. dma_addr_t dmaphyssrc1 = 0;
    . z5 s" S& W7 |
  69. dma_addr_t dmaphyssrc2 = 0;
    . Y! m; U3 t  S
  70. dma_addr_t dmaphysdest1 = 0;" l6 X% u+ x+ t- I$ W4 M2 \! K
  71. dma_addr_t dmaphysdest2 = 0;9 D* V# K7 V9 R2 L1 p$ l3 i
  72. 5 [* X+ d! ]/ \
  73. char *dmabufsrc1 = NULL;6 X0 s. D- K9 r
  74. char *dmabufsrc2 = NULL;
    ! z  }8 M/ o2 W, F2 O3 S! L6 z$ y
  75. char *dmabufdest1 = NULL;/ S6 |0 a" ]# c4 G" n
  76. char *dmabufdest2 = NULL;6 r  u+ o6 [1 D0 y; D

  77. 1 H: T* z. v* }: L
  78. static int acnt = 512;
    6 k- F$ k2 u" A, t6 u7 {0 c0 O
  79. static int bcnt = 8;
    , F) o' `( i* l" q
  80. static int ccnt = 8;
    7 b- D$ e. `: ^
  81. ! Y' S- C, A  D2 S+ ]* ^+ C( @" o% l9 J/ o9 Y
  82. module_param(acnt, int, S_IRUGO);
    2 _8 U8 }# o' O: {8 C2 x5 N
  83. module_param(bcnt, int, S_IRUGO);4 }* {' D7 u/ Q4 ^3 W0 @4 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 R( L$ c6 |. h7 H: g  I! T- g" d* _4 t1 j/ D. B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 N2 v1 [, W8 w5 n# u6 c0 y7 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# \/ u* _( R/ U; K, |8 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, z) D7 D1 Q- t1 @! b1 o  \0 C+ ?9 J& W4 V: ]  ^/ e0 N! ?

$ M1 p( {  o) w) _0 H1 p, g* z- z8 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-1 03:34 , Processed in 0.040703 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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