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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# J5 P! O: x& ^1 Y  [( ~
  1. [code]EDMA sample test application  v* e- n5 |" M- |+ w, |6 H  G  @
  2. /*
    # k" a& u0 F) N: B
  3. * edma_test.c
    1 q! |) P: @2 B! F- @
  4. */ P# s& F+ s) U' e* f+ r" t
  5. * brief  EDMA3 Test Application8 k2 k. \7 h) L  A! r( K
  6. *' r8 N4 E+ R0 r) Z$ f7 A  b
  7. *   This file contains EDMA3 Test code.
    4 @, R3 S  k! u, o
  8. *
    4 i! k) }/ d3 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* r8 _  k) |3 A" G- _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% |" U& S4 M) a' ^
  11. *         TO CHANGE.; e9 `7 j3 W; x) {
  12. *
    6 z8 d3 u) @1 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 |) P% k, j9 y+ S% H6 P
  14. *1 |9 b; d0 ~* G2 z8 i
  15. * This program is free software; you can redistribute it and/or$ A% A5 g+ [) n( T5 r+ z6 X
  16. * modify it under the terms of the GNU General Public License as
    " l& }+ Y$ x+ x, m+ L
  17. * published by the Free Software Foundation version 2.) }" {% x( D% \' \- r
  18. *
    / F, G/ Y" @# q5 q, w+ v9 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) w  q3 B% l* b9 K& f6 o
  20. * kind, whether express or implied; without even the implied warranty. r( A; g5 J5 s- Z& D# ]: i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & S, E9 c9 Z1 @% A, H( z+ j
  22. * GNU General Public License for more details.
    ! [4 [* m) s$ q3 t( \: P
  23. */4 R! z" _. v7 M! _8 g$ f6 D" w" n
  24. ) E  ^6 e. C1 G% G- ]
  25. #include <linux/module.h>
    # V  x, }5 X2 q
  26. #include <linux/init.h>
    . Z5 Z5 t# j# G. k4 o
  27. #include <linux/errno.h>
    - a) j5 y' x. Z& T
  28. #include <linux/types.h>
    , a% F2 B2 z% s& I8 _
  29. #include <linux/interrupt.h>
    % l3 A- F. Z. p* `  c
  30. #include <asm/io.h>" H0 `7 Y0 E( n
  31. #include <linux/moduleparam.h>: y: ]% U, B8 j/ z" T8 w- c* [+ q: \  g
  32. #include <linux/sysctl.h>
    1 C: r1 m, _& d8 g& s+ ^$ k  v
  33. #include <linux/mm.h>
    7 ]5 k" B# e% x: C9 ~( h9 Y/ {
  34. #include <linux/dma-mapping.h>+ G5 q: d1 N! s, m  J0 F+ o, @

  35. 3 M4 j9 {9 w+ ?' D# v
  36. #include <mach/memory.h>) Q8 A$ i/ ^* ^8 ^0 K
  37. #include <mach/hardware.h>
      v; A: f' W! Q4 X
  38. #include <mach/irqs.h>
    2 e$ Y' s3 n! P1 c. o
  39. #include <asm/hardware/edma.h>
    * U# S2 W* H7 S
  40. " J5 _9 K; d1 h5 S+ v/ i
  41. #undef EDMA3_DEBUG
    ; f/ e9 Z( L! w% U# b1 ?
  42. /*#define EDMA3_DEBUG*/0 ?1 ~, w* ~' H( ]2 w1 j! D8 n) y
  43. - ]3 g' l) N0 N, L/ ?
  44. #ifdef EDMA3_DEBUG
    1 o/ T, Z* u" n- ?2 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ K1 S3 s: I( Q: U$ J0 Q5 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( |, s7 M% ?( @; H" o  w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ~' p& `' M# N8 D. e0 {# k
  48. #else
    5 e# j& ?! h% H6 |2 G
  49. #define DMA_PRINTK( x... )
      Y% m# F# y: d& H- N6 @) V/ J/ e
  50. #define DMA_FN_IN
      |, f; z, b: Y
  51. #define DMA_FN_OUT
    8 v5 Z; D$ ~5 H! n0 t6 i
  52. #endif& j5 v, t7 k' g+ @
  53. ; Y7 t  Z% q7 ~$ I) d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), _$ c: m; t* T8 D, {4 c9 S& d7 e
  55. #define STATIC_SHIFT                3
    ( G: `" \) N, V: n* q
  56. #define TCINTEN_SHIFT               20
    ) p5 H, I( F/ w+ S! h
  57. #define ITCINTEN_SHIFT              21
    - t/ g, t2 P6 H
  58. #define TCCHEN_SHIFT                22
    $ O( h, q6 l! Y; c5 }2 A1 r' l$ W
  59. #define ITCCHEN_SHIFT               23. C1 g2 f- {, B6 ^4 @: c

  60. 0 M2 A8 b/ D, w/ U5 T
  61. static volatile int irqraised1 = 0;: A3 q+ e% [3 K- v6 B
  62. static volatile int irqraised2 = 0;
    4 K  f" y1 N) w% @' @& c) o
  63. * `# B7 W2 s3 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * {/ j, z2 o' q! i# S6 d8 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T1 R, e% ^2 P: b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 t5 c0 i$ s+ n0 a
  67. 8 U) h' U( w' n2 n
  68. dma_addr_t dmaphyssrc1 = 0;
    : ^4 D; h6 a$ {& \
  69. dma_addr_t dmaphyssrc2 = 0;" ]' b) y4 r) |) z' t! L% p
  70. dma_addr_t dmaphysdest1 = 0;
    ; z& o6 ]7 a) @7 l' Q) }
  71. dma_addr_t dmaphysdest2 = 0;
    : F  M- r2 n- f/ ~
  72. 7 w7 G. {" z' Q* U+ J! T
  73. char *dmabufsrc1 = NULL;
    ; _4 ]1 W/ R( R( N
  74. char *dmabufsrc2 = NULL;
    & d( p# y8 q1 k' `
  75. char *dmabufdest1 = NULL;
    ( B% D+ P. H8 Y# p3 X1 h$ v5 d
  76. char *dmabufdest2 = NULL;
    ' O$ |. W* n9 B$ ?- G; i( H' f
  77. 1 Z- i% ?3 x* ?' n
  78. static int acnt = 512;
    ! `9 @' X, h0 R2 j. U4 K/ n
  79. static int bcnt = 8;8 P' }& W( L1 B$ g/ n$ e
  80. static int ccnt = 8;4 s% h: X8 W; @" @1 i- o$ G
  81. 3 x; }, c: Y/ i! p( L
  82. module_param(acnt, int, S_IRUGO);  a. @% \& i. }/ l( w+ P( u8 ?) {
  83. module_param(bcnt, int, S_IRUGO);
    ! r+ n$ E) G% m8 r" K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; z  W& z2 ?9 |0 T1 P1 v! g2 o0 ]: q( x1 b6 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ]5 O; r& V+ Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  I' J& X" }0 Q9 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 j; ]/ Z  o  J! e) D/ J- z+ a0 m% P: S

+ V/ \0 G8 e- c. p! S* F5 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-14 06:52 , Processed in 0.041336 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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