OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 q( W0 k' p6 B
  1. [code]EDMA sample test application
    # T9 }5 g- r( x7 }5 j
  2. /*
    " k1 y/ r* J! T
  3. * edma_test.c
    , f! C5 |: X& Y* A4 H  d) W  k
  4. *$ F4 U, y& L! X& \8 `2 k+ {( u
  5. * brief  EDMA3 Test Application
    0 U4 z" c9 C2 N. `% }  J
  6. *  G7 t4 ]1 n/ m. {" d9 k
  7. *   This file contains EDMA3 Test code.: q; p: I; z0 h3 y  O
  8. *
    ! x5 j. e( N$ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 M* l/ |! r1 j  w& C7 L. g9 ?, c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * w# v9 E# c4 _5 V* \- q( }
  11. *         TO CHANGE.5 u' _1 G0 ?3 Z' P
  12. *! Q  `- P( {3 K2 V7 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 i( r6 N2 M. ?* [* ]8 H3 N
  14. *! t' k) \6 A  @( j/ G; R, X* g8 Y& [
  15. * This program is free software; you can redistribute it and/or% y2 N' B' j, o
  16. * modify it under the terms of the GNU General Public License as4 y: Y3 s* U) l4 d! w( n: s
  17. * published by the Free Software Foundation version 2.
    1 s9 R7 @! T$ M  ~, b( j
  18. *
    % N$ A* }* K) m# ^( K- O5 S' g1 U1 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: v) d( G, G5 M
  20. * kind, whether express or implied; without even the implied warranty- w  u% ^% ^% E6 m  A: _# G' k# h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ R0 C" s3 H6 X" \4 D3 f! ]
  22. * GNU General Public License for more details.
    ( T8 I# m6 o; y2 |* @
  23. *// x* o' [3 j& `

  24. # [0 e! J2 V2 P2 g5 l% C5 q3 g
  25. #include <linux/module.h>
    ) k2 ^9 f* ]2 |+ y9 F
  26. #include <linux/init.h>
    1 n  M' W0 a" Q' }% |6 ]* j
  27. #include <linux/errno.h>0 Z$ j* O- H% y4 `  @# P3 J
  28. #include <linux/types.h>
      b- E( g8 e3 D. ?9 C
  29. #include <linux/interrupt.h>+ F4 B* U2 j6 p- I! z- @; ?
  30. #include <asm/io.h>
    " X, y$ b2 k) X* S5 k  M5 y
  31. #include <linux/moduleparam.h>  {/ b" t) N; w- U+ X( w) E( \
  32. #include <linux/sysctl.h>/ G2 X2 ?0 ~# m- e
  33. #include <linux/mm.h>
    8 ?* w  i  z" Q% Y; ]3 `
  34. #include <linux/dma-mapping.h>
    ( ]) i+ u2 E5 j$ Y- v) X; M, }0 F, Z
  35. 5 {, _. p7 x" ]4 d
  36. #include <mach/memory.h>
    - k8 I. Y* H0 Y6 x9 D: y. T
  37. #include <mach/hardware.h>
    * G3 T, `" k  g4 A
  38. #include <mach/irqs.h>6 y+ \/ d0 r$ u$ L. b- a' Z: P/ p0 v/ [
  39. #include <asm/hardware/edma.h>
    ' Q3 [) _4 H+ x) D/ {2 I
  40. 9 J+ ]. d! [( R. o* N. `' A/ o
  41. #undef EDMA3_DEBUG
    5 z; L8 T$ v7 j0 C+ s4 p, z
  42. /*#define EDMA3_DEBUG*/0 C4 p1 J: h- x, n' N0 D

  43. ( G+ p; h' p, y& w9 d
  44. #ifdef EDMA3_DEBUG$ A8 ?- m8 q+ I! J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 |4 f. T/ F$ {& m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), m0 K% e9 K: k) x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 e+ J1 ]+ L/ Y) W; _) U
  48. #else: Z, `" p  e6 y) _+ u% N  h2 @) X
  49. #define DMA_PRINTK( x... )
    1 r' V# g0 _! o4 q: y8 e+ h+ \
  50. #define DMA_FN_IN% e- a* _. U/ a' z
  51. #define DMA_FN_OUT# Q  P8 l) q( ^0 l
  52. #endif: `4 G0 s, |2 V8 D) A

  53. 6 O! T& w! b- @  }; K# k" \/ L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( M+ _# a, n, I7 T+ b
  55. #define STATIC_SHIFT                3/ O( z8 [$ W% `# F, ~/ H
  56. #define TCINTEN_SHIFT               20
    : o' h8 q# s  ~7 y/ t; Y
  57. #define ITCINTEN_SHIFT              21
      m' \9 x, o2 ~6 T, N: f
  58. #define TCCHEN_SHIFT                22
    + h! c$ k5 e9 v) R2 v: I) W
  59. #define ITCCHEN_SHIFT               23
    1 ~7 e. [5 E+ G+ K

  60. " H' _" x) i5 x& |- @) K
  61. static volatile int irqraised1 = 0;3 G9 e: |4 I# g+ g; ?: f* g5 {  d/ T
  62. static volatile int irqraised2 = 0;
    5 N5 ~; g% ]9 m

  63. 7 y4 a7 m# i% v& k9 g6 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E. t* }: ~- R; F( g$ |* P2 T; \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , L" ~" h+ N; y- X" c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 \. T5 F7 w0 X2 C/ b& _

  67. ' b+ N8 r" ^0 e6 g
  68. dma_addr_t dmaphyssrc1 = 0;+ |1 P6 Z) c) t. e) H. h% K4 C
  69. dma_addr_t dmaphyssrc2 = 0;, E6 f2 Q6 e- G- [
  70. dma_addr_t dmaphysdest1 = 0;
    6 A# Y9 v# F7 q) [1 W% b
  71. dma_addr_t dmaphysdest2 = 0;( i! f% r" S! e

  72. , L9 l+ z$ m; U$ C! F" X$ H  L
  73. char *dmabufsrc1 = NULL;% E: O" m7 k# F0 ~6 I4 u* r& l' N
  74. char *dmabufsrc2 = NULL;0 R2 K, P7 @2 I- E- `, `
  75. char *dmabufdest1 = NULL;
    % r& Y5 [' @; K- `; y8 H3 A
  76. char *dmabufdest2 = NULL;
    8 X# b$ Y! \1 @' c

  77. * `6 V7 H( k/ X
  78. static int acnt = 512;- D) ]% l$ l5 }- k6 k5 f  }
  79. static int bcnt = 8;
    . ~8 S* l  r+ u  A. }  r5 x
  80. static int ccnt = 8;1 q, u) b- h3 ?8 z4 K) R
  81. , K. s  q2 v9 I" H
  82. module_param(acnt, int, S_IRUGO);
    5 W  Z7 [8 _9 z8 e6 y3 {$ C
  83. module_param(bcnt, int, S_IRUGO);* h# X' a% o4 Y$ ?& _* c7 ~- ^7 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* |+ ^% e5 _7 I6 @) |( X
9 d" t* f7 t2 }/ M- C4 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( }8 }! i* l7 e$ c$ h1 W* _8 W. yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. b$ C) T7 m$ T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! J/ O/ _& W* f2 y* A: D
2 i$ T) D( n) U2 E, l3 ~5 o2 b3 J9 f( `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 05:46 , Processed in 0.038886 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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