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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , h# l8 z- q& [( o( s
  1. [code]EDMA sample test application
    , p$ R2 d+ X8 ?. W" b
  2. /*
    ( N# g. A  v* ]" m0 H+ S- K6 t. _
  3. * edma_test.c' f! v6 \9 x9 Y$ k5 S& [, A# R3 M
  4. *
    4 F& Z# i; I1 ^9 U* k: d0 x
  5. * brief  EDMA3 Test Application
    5 P8 i+ O# F; q
  6. *
    ! I/ R- _3 T" Q1 ]; u2 m
  7. *   This file contains EDMA3 Test code.0 t; S- i; J/ y+ Y" W- c. F, A
  8. *
    9 X  m# d3 {3 z, ]" {3 u; `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- B5 u: C, e$ x  A" F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- b/ V# a! F) N' d4 h% J
  11. *         TO CHANGE.
    * w  Y; t: h* n9 S! _2 C
  12. *; S; g! k/ J9 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 L& F7 m: }1 S/ A$ z" C. b2 o
  14. *
    7 Z1 i4 w  t! G
  15. * This program is free software; you can redistribute it and/or
    ) m/ M: D/ I9 Q0 ?9 T
  16. * modify it under the terms of the GNU General Public License as
    % H8 \" f6 l' K, y
  17. * published by the Free Software Foundation version 2.
    & P4 Q. e9 G# L; S( L% k
  18. *
    3 y6 n( V+ A5 H8 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ?% A$ ]- c- s2 f3 K5 e9 I; J
  20. * kind, whether express or implied; without even the implied warranty
    9 M* S& y5 I9 f( v4 ?+ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# e: P% T7 l  g# a: x+ y, c
  22. * GNU General Public License for more details.: ]0 C' T! x' w# C. `
  23. */
    , R6 n0 @4 [& ?/ d/ {; y

  24. / T+ j* P: c+ c
  25. #include <linux/module.h>, L! E- Y" Z/ o2 A, D
  26. #include <linux/init.h>
    " m  U. _  W5 ?
  27. #include <linux/errno.h>
    4 N- p3 D  l4 H# y  R8 N6 k
  28. #include <linux/types.h>' ]5 S, ]2 I# [7 a# E
  29. #include <linux/interrupt.h>
    0 w* J9 I7 w4 `; K* c
  30. #include <asm/io.h>4 ]8 b7 w# W2 [7 J5 b4 B
  31. #include <linux/moduleparam.h>% y; ]- y" i( O3 v7 Z
  32. #include <linux/sysctl.h>( n* }: p. n0 o: o: B
  33. #include <linux/mm.h>
    2 X4 {+ z) J1 g- J
  34. #include <linux/dma-mapping.h>8 T- \: w9 N) H4 u+ A' c

  35. 0 S, r, _  G6 F) \* H
  36. #include <mach/memory.h>& t! O: n& v/ H0 i( H  t- V
  37. #include <mach/hardware.h>
    ; D* M% m) g( z
  38. #include <mach/irqs.h>
    % w+ r3 h/ q$ ~6 k& {5 |; C5 y
  39. #include <asm/hardware/edma.h>! b! f* r, _% o% H& }4 `- q
  40. 6 P% j" A2 D  i7 c5 @- F, I8 i0 \
  41. #undef EDMA3_DEBUG
    : P. Q( \, {- P. n# L% ]
  42. /*#define EDMA3_DEBUG*/
    * v% @' p7 O9 I! @& K3 q

  43. : a/ P8 s0 C9 V( U% L- i; e6 o% y
  44. #ifdef EDMA3_DEBUG$ u& l) \% C% S$ E5 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( n. B8 v" E4 p4 ~4 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . }  \" l# m: C: k6 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      w& w5 y" ^& m* s7 z; k
  48. #else
    2 q; k' I8 u6 j+ |5 |- [: {
  49. #define DMA_PRINTK( x... ). ]. F! h/ K* `- [  ?3 i
  50. #define DMA_FN_IN( b) a7 N8 z( c! R
  51. #define DMA_FN_OUT( H; B9 F' }# p& W
  52. #endif
    ' U1 p' m/ i- G7 \& ?- l

  53. 2 z# P( w' ]% f& A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). M- E$ S9 N: Y: T/ @, \) l& {
  55. #define STATIC_SHIFT                3
    7 s* G9 Z4 \6 i6 y
  56. #define TCINTEN_SHIFT               20
    5 E8 ?  {/ ?8 h
  57. #define ITCINTEN_SHIFT              21
    0 m  k  F" I" z
  58. #define TCCHEN_SHIFT                22. x0 u( D* x9 v' ~. H! V, r
  59. #define ITCCHEN_SHIFT               23
    % @6 @4 f+ ]0 ^* y( v& ^8 M
  60. 1 g" w# \$ t- i7 {+ t
  61. static volatile int irqraised1 = 0;
      k% S" m, [: B! ?+ {8 f& }* p
  62. static volatile int irqraised2 = 0;4 N( s7 r, o( S) z7 {1 ]& d' t, C

  63. ! ?6 j) c% ~+ @- D0 h' U3 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; x* ]9 `$ u! e2 H0 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      J( B" U5 k/ v) |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 T0 ]% r1 n8 v
  67. 2 P3 d) z4 R( M" Y) v
  68. dma_addr_t dmaphyssrc1 = 0;
    : D, ?) i, O$ C4 ^8 ^
  69. dma_addr_t dmaphyssrc2 = 0;; K2 {  G' x' a! a
  70. dma_addr_t dmaphysdest1 = 0;
    * \1 D! }' N' F( o
  71. dma_addr_t dmaphysdest2 = 0;, r  W; e" v7 {) `/ g: B( [

  72. 0 e& U4 i5 v, r
  73. char *dmabufsrc1 = NULL;
    8 I, O' J% V0 n( ]
  74. char *dmabufsrc2 = NULL;
    3 y  i7 d2 C5 x0 N, ?" J# Q  u
  75. char *dmabufdest1 = NULL;0 g& W) D3 X1 U7 t6 _
  76. char *dmabufdest2 = NULL;( t& M4 k- y+ B0 i2 g' q) c

  77. 9 o2 `# d* G2 h7 W. q0 m* a2 u. e
  78. static int acnt = 512;& S- B- b3 p9 l" B: p& C+ r
  79. static int bcnt = 8;
    + m2 x6 h' ]" F8 A5 }' N1 P4 D
  80. static int ccnt = 8;7 P6 k% u. H- g( [, J2 d. z0 Z1 d
  81. + r* ?. r2 h8 S; r
  82. module_param(acnt, int, S_IRUGO);, @6 e; i  X: H: w# e
  83. module_param(bcnt, int, S_IRUGO);
    " b0 V3 v7 ^( s+ l$ P* N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 g+ M& D# N$ Z( _7 f

" t6 `- Q- S2 w/ v; X( ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  _; ]5 Z' A( ~% n+ K6 h( U  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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* Z2 F' [+ q. J/ M' c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 J- x% g* ?% Q, o' n
7 j) Y1 U5 G) ^% S" V" {$ Z5 B) t& M/ w  M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 08:44 , Processed in 0.039144 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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