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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ Q3 G/ A6 ?* ^# i. _
  1. [code]EDMA sample test application
    9 _' }7 N( w' h! y
  2. /*
    4 t& a; n) b6 g! R
  3. * edma_test.c& N) y! F- |7 s" n$ H, j" K
  4. *
    & r8 w0 `( ~: n: o* I: ]& g
  5. * brief  EDMA3 Test Application
    $ l2 N0 O& Q/ e* t$ Q
  6. *
    9 \1 [3 o; B/ n' N9 O
  7. *   This file contains EDMA3 Test code.
    ( ~0 W. }2 ]2 E0 M( |, Y4 U9 `" E
  8. *! ~+ b4 k$ d" u- h& H, m. z( L& Q2 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - p6 N9 y; j% x7 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . G0 @2 r% U7 _$ [8 h/ o* ?: _8 e- D
  11. *         TO CHANGE.% Z" _& O( h$ n# b5 m3 M
  12. *
    # t$ }) g8 s& U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      h% ]. ^0 ~& |4 h9 Q. f4 w! Z8 {6 E
  14. *% x# n8 h6 L  a& d* T& X' A
  15. * This program is free software; you can redistribute it and/or
    5 j) i- ]7 C2 W; T5 M
  16. * modify it under the terms of the GNU General Public License as! ^" l  N% i8 y+ o' G
  17. * published by the Free Software Foundation version 2.
    5 a) Q9 Q, G, k/ o' V- @$ }
  18. *
    " e1 h# N: {4 V9 K9 ]  k* d# N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z/ r7 x$ M) `# K) m+ t
  20. * kind, whether express or implied; without even the implied warranty6 P1 j, K9 g7 {% S: ]/ a7 u7 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  U+ T3 P- q0 p4 u2 O
  22. * GNU General Public License for more details." y: g; |8 c. c! ?
  23. */
    & L+ v) E' z) j7 s" [" a8 |
  24. # J9 p0 j" q3 M2 L
  25. #include <linux/module.h>
    : Q% J  M: r) {6 o9 ~  I7 g1 I
  26. #include <linux/init.h>
    5 x( M9 [4 M" G  W
  27. #include <linux/errno.h>
    0 ]: \2 ~4 A* F- A) w9 P
  28. #include <linux/types.h>8 p8 H5 N# M4 K+ k& @! R8 C, s+ S
  29. #include <linux/interrupt.h>
    - w* |; T* x' h
  30. #include <asm/io.h>
    ' S* v+ z# G" V6 _' J: @' v
  31. #include <linux/moduleparam.h>
    & Q( g2 I3 W9 G9 @7 l  l; \9 Z; s
  32. #include <linux/sysctl.h>
    ! O  h: q) K/ I/ @
  33. #include <linux/mm.h>
    4 h5 w5 u/ ~2 J5 k
  34. #include <linux/dma-mapping.h>
    0 I/ n7 b5 _0 X# U  d

  35.   E# M. t; \8 F
  36. #include <mach/memory.h>
    2 g2 D5 k1 x! c) t9 q3 k. X+ r2 ~
  37. #include <mach/hardware.h>
    2 J" e1 Y+ v/ F+ ?5 s/ n% W
  38. #include <mach/irqs.h>1 a& O/ ^+ h# l% Q2 K
  39. #include <asm/hardware/edma.h>
    + \. |% ^6 h. ?, D! m4 f
  40. 5 R7 j. ?% V% ]$ H+ Q
  41. #undef EDMA3_DEBUG
    ' a& Y& k2 C) \8 ~# h
  42. /*#define EDMA3_DEBUG*/6 |! F/ p  Z5 Y6 c" M) W

  43. % k" J5 k! t! l4 }1 J5 u
  44. #ifdef EDMA3_DEBUG
    $ H( g. t) H: q- v1 e: T1 K2 {/ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 \% D$ J, P& i6 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( g: Y& n3 x  y$ M. I: h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 C6 w/ K; P# d: m
  48. #else
    ; F% }/ k$ N9 f  R4 h2 N
  49. #define DMA_PRINTK( x... )
    0 N: Z' X2 Y% a0 F5 q5 u
  50. #define DMA_FN_IN2 d0 v- ~: c9 v1 M
  51. #define DMA_FN_OUT* L. W; Y; Q  Y/ }. T  g1 s' d: o9 A
  52. #endif6 d1 j& v5 Z* u6 G% Z8 b
  53. . {7 i3 c# n$ N7 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & d( o& k3 \1 c
  55. #define STATIC_SHIFT                36 f" v' ~) a% F/ y
  56. #define TCINTEN_SHIFT               20
    4 D% D0 L! q% T$ ?' @8 V# C
  57. #define ITCINTEN_SHIFT              21' J; r8 i4 v6 m5 ]2 k
  58. #define TCCHEN_SHIFT                22
      e* s/ y7 A" t: |9 S+ i; X
  59. #define ITCCHEN_SHIFT               23
    . e; J# o( s3 T( G4 D/ W
  60. 5 f5 _- N4 u. Y* T3 Q
  61. static volatile int irqraised1 = 0;
    + M! ?0 B6 m( h7 N9 Q
  62. static volatile int irqraised2 = 0;7 S2 G; u' b- Z, S$ m. i
  63. 4 ~( @4 ]4 k- U) x( K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & G6 y) X% t* r7 v$ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J7 U' F8 t' V0 w# I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 J9 w- C: U$ j! f* i) b
  67. ( H4 V7 L% j% E
  68. dma_addr_t dmaphyssrc1 = 0;
    $ L& L& l) `0 X' y
  69. dma_addr_t dmaphyssrc2 = 0;
    : u3 H) ]; }' X" M: ~$ Q& s* m- i
  70. dma_addr_t dmaphysdest1 = 0;
    . c* Z: T& k% i) u
  71. dma_addr_t dmaphysdest2 = 0;
    4 ~' O3 Y' {! |: X# v6 S

  72. ( K3 |$ i8 @7 `4 e* z/ }/ x" I
  73. char *dmabufsrc1 = NULL;
    % _# @' A" C( v# Q
  74. char *dmabufsrc2 = NULL;; Y* N8 r  X# ?# Q( I8 y$ [1 [! Z
  75. char *dmabufdest1 = NULL;; y, ~% C6 k' S/ \& N) y
  76. char *dmabufdest2 = NULL;! w8 `9 u7 M+ P0 S6 M8 [9 I. k: X

  77. 3 H7 }! H. U  m' w
  78. static int acnt = 512;9 V# ?4 ^8 Y5 D! D" n
  79. static int bcnt = 8;
      B$ D+ @& b0 ^, U/ q# j7 j
  80. static int ccnt = 8;
    $ u  R( G; r$ j1 [! f- R$ u( v9 m

  81. 6 O4 E6 b% U4 [* c
  82. module_param(acnt, int, S_IRUGO);
    ( H* g4 c$ z) m. A( g6 N
  83. module_param(bcnt, int, S_IRUGO);! s, ?- w6 ^  Y& w  w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; Z5 \) X, J  B. f5 s( Y: l2 H- {

' u; `* P1 H" H4 E5 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 y3 ~+ a7 k* v4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* @4 z( |  }: q2 N/ Q" b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 i5 P% i" f+ v9 \/ v. Y8 f- j$ K, _9 L

3 g/ z* @! a4 p/ S/ z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 01:33 , Processed in 0.039817 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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