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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( B7 m. s& i: T) ~3 Z9 e6 [
  1. [code]EDMA sample test application; U& l' J! `6 q  A/ ]. }( a2 h
  2. /*
    , R3 p% X; i- d/ P' h5 \
  3. * edma_test.c1 x* k% X9 X+ Y" c" E
  4. *! d% y/ Q/ P  d1 Q6 |' c. ~) u7 `
  5. * brief  EDMA3 Test Application* G, z- k( F+ J  W5 E+ S1 y
  6. *- S0 ?9 g8 L3 a, w
  7. *   This file contains EDMA3 Test code.
    5 @' f' O+ N& M6 ^* t4 ^) Z
  8. *8 y( ^# [. N  e# e9 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Q3 N6 M  S# _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 w( e. F0 E3 L4 `0 r
  11. *         TO CHANGE.  Y7 v- H" t" |& r: w- M) Z
  12. *
    2 v; ^0 r* V! X, q: N2 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 i% r: x9 i( x" @: K: m. G- U, G
  14. *
    0 G/ V1 t- u. |/ d6 C
  15. * This program is free software; you can redistribute it and/or. }; n  D5 b4 X+ u* M( Q
  16. * modify it under the terms of the GNU General Public License as0 {1 q, n6 F* b8 I( J3 r+ O
  17. * published by the Free Software Foundation version 2.
    6 b/ ?7 G0 f# ~2 z) {5 A2 P$ Y
  18. *
    9 z4 N1 M) }7 L( n. M& A8 B9 h7 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - g8 {2 _& S5 ?. ]) @
  20. * kind, whether express or implied; without even the implied warranty9 `0 G9 d; }% U$ x4 L! t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ W8 g! }  W  A7 t
  22. * GNU General Public License for more details.
    3 x$ W( P! ~6 r% ?8 }3 B+ q
  23. */
    , L, A$ v9 g/ \8 D' V
  24. 4 D8 l: n( F7 ^( h- I
  25. #include <linux/module.h>$ X: d3 J( Z" V, }
  26. #include <linux/init.h>
    9 C! v  J' C% k0 i  J( {7 z
  27. #include <linux/errno.h>  B+ M( \, M8 {' y3 z& w
  28. #include <linux/types.h>3 B" I- p* ]+ s$ W+ a2 S/ t
  29. #include <linux/interrupt.h>
    8 U; m, G' Y+ N$ C$ N& Z
  30. #include <asm/io.h>9 j6 E$ Y9 z) m0 T5 ?
  31. #include <linux/moduleparam.h>% P! a1 m- N- G
  32. #include <linux/sysctl.h>$ ^8 ?2 H9 p% M2 l/ i
  33. #include <linux/mm.h>* W1 D8 r& ^! L) `; U1 Z
  34. #include <linux/dma-mapping.h>
      Z$ \/ i/ \$ g0 u5 `
  35. # @  H/ f) r. N7 H- Z* ~
  36. #include <mach/memory.h>
    5 \" P9 m9 b- {, G1 K- v; q( f9 s4 k
  37. #include <mach/hardware.h>- S- N5 m# |9 Z# P, F5 w9 w# `
  38. #include <mach/irqs.h>! t; h8 z7 f7 t9 m( @
  39. #include <asm/hardware/edma.h>
    ! J) e+ S0 _* o2 a: L

  40. 2 M1 m; N3 u+ g* S) l
  41. #undef EDMA3_DEBUG5 C$ ~- s6 V5 k5 X; z6 o1 F
  42. /*#define EDMA3_DEBUG*/
    4 f3 h" x! X  T) ?6 X: v
  43. ' K7 @3 Y3 }+ l) O4 `
  44. #ifdef EDMA3_DEBUG; l' Q" L$ p7 M  J3 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), }) ~( Q& m) N5 F, P$ X0 J$ u! L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 y/ I, p+ A9 m3 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 m/ @3 y! ]* ]6 G6 }
  48. #else
    , L' O' D& |! _8 a
  49. #define DMA_PRINTK( x... )
    & |# u: ^' {. s, `  U) w
  50. #define DMA_FN_IN
    # T# f$ ]5 ]  k  n) w1 S4 Z& O
  51. #define DMA_FN_OUT+ G' c( I; Y1 u
  52. #endif( c! x; f5 W4 W% y% q

  53. 0 g9 ]0 P/ u& J# z2 _& ^/ Y# w' q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# Q8 m5 w3 y: K! g% j
  55. #define STATIC_SHIFT                3. _' Y6 J0 p3 L/ {) x- e) \
  56. #define TCINTEN_SHIFT               20* a( B3 F, ]: h7 k7 ~
  57. #define ITCINTEN_SHIFT              21
    3 g7 [1 p" ~+ u5 E
  58. #define TCCHEN_SHIFT                22$ {5 H! }# [  {+ `/ s+ J7 P
  59. #define ITCCHEN_SHIFT               23
    & v4 x4 B$ f0 e! m1 B
  60. 3 h. K% U' w$ Z- M" h% I+ t9 D# V
  61. static volatile int irqraised1 = 0;
    + O% g; v( h0 k6 r1 O2 O5 q
  62. static volatile int irqraised2 = 0;7 _7 M% @9 b& u0 }) m) P/ D
  63. " w$ _3 e! Q2 X0 }/ Q; o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . h6 z( z& V/ U2 p' O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( v! [8 G/ _/ c; Y' v) J4 h  I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ~' G( d+ I/ g8 p* x

  67. ) {  \2 s- u5 {5 N
  68. dma_addr_t dmaphyssrc1 = 0;6 ~6 X. K7 }7 K
  69. dma_addr_t dmaphyssrc2 = 0;
    ' o& T. `8 F- J' R+ M; D" w' P
  70. dma_addr_t dmaphysdest1 = 0;7 W+ u9 ]; m3 a$ p( R6 S/ h2 F
  71. dma_addr_t dmaphysdest2 = 0;( U3 [# y* C; o4 p+ @" h0 `
  72. 3 b3 b3 b8 v! V4 w$ z" S
  73. char *dmabufsrc1 = NULL;
    $ E/ r1 n8 K" j4 V& A5 G6 z0 U
  74. char *dmabufsrc2 = NULL;
    ( V6 a5 {3 L  A
  75. char *dmabufdest1 = NULL;% W5 {9 \# l" G+ w& ]. Y
  76. char *dmabufdest2 = NULL;
    $ B& o+ N, M- P- `1 `

  77. 8 D2 f$ F. v/ `! i
  78. static int acnt = 512;
    ( `4 i+ |; {: H) [1 i
  79. static int bcnt = 8;
    7 h) R4 e$ D! e, y! T# d; D; }
  80. static int ccnt = 8;
    ! Q8 i3 ?, n3 s! X% e

  81. 3 t! a. w" p+ ]0 N" v
  82. module_param(acnt, int, S_IRUGO);
    ' \4 h4 W9 ^% S8 d6 ]) [5 ^/ a- _8 p! O" T
  83. module_param(bcnt, int, S_IRUGO);. ]  Y) ]# a6 p2 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ K& x# L& M' A9 c
& J9 @# f* ?3 a6 x6 d% c; \! x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 W2 }* P* H4 K7 A6 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) P/ `7 Z% }  ^+ ]. Y3 t5 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 b0 U9 N" C) b' _3 N

, S8 j* _" a9 b' h* q0 Y% q- j" y* _) t+ a1 }! E9 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-29 22:23 , Processed in 0.046431 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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