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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , l! v$ I3 h( e3 o9 ?
  1. [code]EDMA sample test application
    & ~' m8 q. }* s8 ]5 S# O
  2. /*
    ' L, K3 E' U9 r( k& z6 v# ^: }  E
  3. * edma_test.c+ F; ~0 [- b- z, U5 ?( ]
  4. *( {* w4 K2 U: v6 r2 ?2 {( b
  5. * brief  EDMA3 Test Application! k. @; a; n; `; L- U4 l
  6. *& P/ p4 A: {: F/ r& ^
  7. *   This file contains EDMA3 Test code.( Z; q6 a+ z: D8 w! z. i
  8. *
    % s: W! p- X/ Y3 E& _' ^# r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! f/ H6 k0 [. J+ x2 I4 l' T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! l; {9 U0 }! b! m3 H) d
  11. *         TO CHANGE.& i1 s0 K% {* `9 d) i, [
  12. *2 Q- Y+ P( R+ w$ u4 t" R( H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 I. T9 Q+ ]2 q; C2 V
  14. *' V0 i% R: ~/ P8 y4 V% L* g
  15. * This program is free software; you can redistribute it and/or
    + x1 \4 U, c5 @) W1 f8 `* \
  16. * modify it under the terms of the GNU General Public License as7 Z& r* A! {0 d% @; O
  17. * published by the Free Software Foundation version 2.
    8 W/ |- N/ w0 N7 ?: y. g
  18. *
    0 T2 |$ A" n/ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 O" G8 l4 A( L$ W
  20. * kind, whether express or implied; without even the implied warranty8 N1 m1 T2 @7 G5 f# p5 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' P7 b/ g. |, C
  22. * GNU General Public License for more details.
    / ?& P  B7 H( ^. ?, S- U8 v+ j
  23. */) }6 Q7 F: a& N  C% x

  24. 1 V  h7 D: m7 e/ H& ?+ u
  25. #include <linux/module.h>
    + _" |- b( `# ?: ]" [
  26. #include <linux/init.h>
    ' P! S" D) Q: o( B
  27. #include <linux/errno.h>
    3 I8 y  x8 ]  e; L" \
  28. #include <linux/types.h>
    - H: W# j6 a' d& g  V9 x
  29. #include <linux/interrupt.h>5 y% o/ N8 i/ ?9 v1 Y
  30. #include <asm/io.h>6 S8 ^- f0 H  G5 Y2 X2 @
  31. #include <linux/moduleparam.h>
    , }, B1 o- ~, U4 b  U3 Y$ F
  32. #include <linux/sysctl.h>3 G- L5 F! b5 j" K7 H
  33. #include <linux/mm.h>
    & J, U0 [4 W5 h& D
  34. #include <linux/dma-mapping.h>
    5 g; a( s+ |: r4 K) O0 [" {( M
  35. 1 i( C$ y$ I8 v6 j3 @. |- o3 R
  36. #include <mach/memory.h>* j+ h, J8 I" {1 i- J( ~; O8 r
  37. #include <mach/hardware.h>
    ' N3 }! C7 [/ S! A# g
  38. #include <mach/irqs.h>
    * y7 Q8 _' \0 k7 B: w8 B
  39. #include <asm/hardware/edma.h>
    ( N* E: j! m. T/ N
  40. 2 ]2 i$ G+ I( i& J
  41. #undef EDMA3_DEBUG* D6 R9 e+ R) n" |
  42. /*#define EDMA3_DEBUG*/) A  V3 j! f; H& d
  43. 9 v5 e: ?6 [: W$ S% D1 I/ H$ I- a
  44. #ifdef EDMA3_DEBUG, p8 L# p9 Z5 _  [( }% f. v0 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 Z# m, }0 M" e/ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! g" n, H' K* c8 `) z1 k2 q+ L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* D1 O& k. o) k% s
  48. #else
    & V7 K- L' j1 _: f# G! _
  49. #define DMA_PRINTK( x... )
    0 n" N% s  G/ i! U% c, t7 f
  50. #define DMA_FN_IN3 Z2 J0 o5 ], U& L
  51. #define DMA_FN_OUT! w7 Y. M3 t; k! _+ V3 }
  52. #endif% U  n8 j9 [1 O) _: E
  53. + |& T$ H3 G* }! w8 ^) q1 ^+ O9 A) S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% r7 ~% C) ^- b8 f8 Z! P
  55. #define STATIC_SHIFT                3' x/ e7 \, C' f
  56. #define TCINTEN_SHIFT               20
    . [' N6 F' e$ j9 J8 y# W- d
  57. #define ITCINTEN_SHIFT              21% ~7 Z1 z7 G6 r( @8 G* H
  58. #define TCCHEN_SHIFT                22
    4 _6 M  B2 ^4 t0 Z
  59. #define ITCCHEN_SHIFT               236 F! Z. ~& \7 ^: t- x( v
  60. - g! Q' O8 @# g8 {% m+ Y+ e6 b
  61. static volatile int irqraised1 = 0;9 W4 b+ v( m9 D' M8 `1 _
  62. static volatile int irqraised2 = 0;
    % F) s* x% T3 O* p

  63. # A+ |( i6 s1 ^+ j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G) P/ D/ F2 u* ]" D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z7 R  D; O+ o; O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + U% A$ N8 G) o2 n4 e/ b: e

  67. " C/ x; Y* M7 t  n
  68. dma_addr_t dmaphyssrc1 = 0;
    9 o" [$ V9 d2 L7 P; G' m
  69. dma_addr_t dmaphyssrc2 = 0;
    : Z8 B* u3 _8 Q( u, q
  70. dma_addr_t dmaphysdest1 = 0;
    ! t( @. f/ l* L. x# j" `
  71. dma_addr_t dmaphysdest2 = 0;4 L; i, e3 @/ ^7 s

  72.   [' O1 c$ H1 K9 k- o
  73. char *dmabufsrc1 = NULL;
    # b/ V% V: t' X! ^4 C8 u; a' Q
  74. char *dmabufsrc2 = NULL;
    3 r- V( t4 W) x5 |2 ^+ E* q
  75. char *dmabufdest1 = NULL;8 w6 b2 Y/ m4 K$ Y  x  }* ~
  76. char *dmabufdest2 = NULL;* H3 [' q( {0 b5 W  M% n* T9 A, |% `
  77. : i( j; z( I0 @) ^" n' Z/ R
  78. static int acnt = 512;$ a- n& s: L0 a6 X/ w8 ?
  79. static int bcnt = 8;
    4 {) x# y# l) u% m# q! G# s# Q
  80. static int ccnt = 8;( a( s1 ~$ p+ P8 [" `  Q

  81. * b0 r. ?8 W+ y# W' G
  82. module_param(acnt, int, S_IRUGO);- s& y8 `4 k; g; M! O
  83. module_param(bcnt, int, S_IRUGO);' K, C9 h) u, d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 j' }. a, b6 D& z( M9 f7 v  {

6 ?8 A3 s% M4 B$ e1 N7 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" [/ {$ e# P  w+ g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( g: b3 L$ {) l' A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 v) m: q) N! q3 q$ W% N7 M) g5 I9 _$ ]% F. E" U
; G! U0 f7 R9 d% V; g( n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 05:26 , Processed in 0.046561 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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