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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  }  Q9 X6 h1 r1 J4 F7 [
  1. [code]EDMA sample test application0 H, n$ O6 G, U$ Z
  2. /*
    ; ]6 ]5 J4 N/ [" x$ L
  3. * edma_test.c5 i1 Q* }- p( `4 N# I
  4. *, A6 ~9 k. m6 m
  5. * brief  EDMA3 Test Application; i7 g4 J* {6 r- w
  6. *! m4 S7 A2 O* p0 }/ Y
  7. *   This file contains EDMA3 Test code.: Z: [# ~/ i1 m6 Y' A+ q
  8. *! X% j/ q, T& y7 A5 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 p8 h. m0 D+ h3 j6 U5 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * ^% S2 D7 q) Z4 u" l7 l7 h% D
  11. *         TO CHANGE.
    6 U8 t0 \7 k- |
  12. */ y4 t% u, V$ p# a# e, A* F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 |, O% @; z6 \) M! h% S1 O
  14. *5 J2 ]& h; }+ |! l1 G: V
  15. * This program is free software; you can redistribute it and/or
    + {4 c2 f$ E3 m/ L' {
  16. * modify it under the terms of the GNU General Public License as2 j' x* h( X. e9 p9 s% l
  17. * published by the Free Software Foundation version 2.3 s# i: _! L% o8 n: r, G
  18. *
    8 i* ?2 k3 r* w6 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 B! K, k8 k; h: Z
  20. * kind, whether express or implied; without even the implied warranty
    7 c7 e8 I+ f$ F( |" M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " r( v% x1 H( S' \
  22. * GNU General Public License for more details.
    6 n1 [" W) b6 S9 [. X0 x: d
  23. */: }+ w- N+ _0 D2 I
  24. 9 v3 z8 c' I0 u# q
  25. #include <linux/module.h>, c& U9 b: Y/ H' ~( x* C) Z( r/ @
  26. #include <linux/init.h>
    , j9 O3 i# m( N, l
  27. #include <linux/errno.h>
    4 Y8 p  ?4 s, r) V1 j9 }* O
  28. #include <linux/types.h>5 j5 ?0 c& n7 D5 }) i; b
  29. #include <linux/interrupt.h>/ r. ^: D* ^+ C. t6 L" I
  30. #include <asm/io.h>/ T6 ^0 J' p' R4 {0 S
  31. #include <linux/moduleparam.h>
    5 {, m" i- H- E" d$ R% Q
  32. #include <linux/sysctl.h>
    2 z1 }7 g' h4 K' X
  33. #include <linux/mm.h>
    ( v+ a7 y. c2 Y0 g3 l
  34. #include <linux/dma-mapping.h>
    ) J( S& ^& U! l0 s- M; h

  35. 7 S+ ]1 u, p$ \8 A& w
  36. #include <mach/memory.h>
    & D0 l$ A, Y) t+ Y/ `+ ?/ U
  37. #include <mach/hardware.h>
    - E% i/ q9 j5 U2 s2 M" Q9 f
  38. #include <mach/irqs.h># P6 I. g' E5 H; N5 W- v
  39. #include <asm/hardware/edma.h>5 _% d% T* A" ]; b4 }

  40. 5 r. l. A3 X  S! F/ ]0 X
  41. #undef EDMA3_DEBUG' ?# D+ @8 J- k5 ^8 I, H
  42. /*#define EDMA3_DEBUG*/# o; X4 B( H/ _& c2 a; H; J: l

  43. * D% h* u. S9 F
  44. #ifdef EDMA3_DEBUG) [6 {4 f3 k. U5 B) v! E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) M/ w! k( m' S# |- C5 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 k! E! g' E8 z" T! z  k9 V: U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* H6 B0 _. `0 P: k" a' _2 u4 B, c  D* {( k
  48. #else( [8 H6 ^) o  c
  49. #define DMA_PRINTK( x... )( _* w3 G! i" e1 X
  50. #define DMA_FN_IN0 C, [7 E' ~! s
  51. #define DMA_FN_OUT3 d8 \, @2 p# s8 H$ _  s# A
  52. #endif# k# q/ g  p. @

  53. * d" l/ m/ e$ o( v9 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 Y: z/ N5 B1 F3 q
  55. #define STATIC_SHIFT                3
    1 F# V/ C' y5 \: ]* I9 A
  56. #define TCINTEN_SHIFT               20' H! M+ k2 \& y% B7 x
  57. #define ITCINTEN_SHIFT              21
    3 `6 V! s) `3 a' p4 d8 P: L* _/ |2 C
  58. #define TCCHEN_SHIFT                22* j# i) N- ~3 L6 P4 |) ]# I
  59. #define ITCCHEN_SHIFT               23% g2 R$ T( Z5 d9 z6 _5 H
  60. / h0 E( k* R1 J7 _0 h* L
  61. static volatile int irqraised1 = 0;
    % ?3 N) X1 A9 J& g) N& I+ |1 g
  62. static volatile int irqraised2 = 0;# V# m& j1 K1 x; w) e3 w
  63. 5 t# y; x6 L" S/ B5 @! L, z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 B1 T- O: Q/ {, L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z  K6 v/ o+ u3 b+ T: a5 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' C- o7 f3 V3 G) e8 S5 ?2 Q
  67. 9 |% l: V/ u& J1 b" ^, r" f/ U# R: h* ~
  68. dma_addr_t dmaphyssrc1 = 0;
    % Y0 M5 T* M0 X+ ?" L. T0 R3 K
  69. dma_addr_t dmaphyssrc2 = 0;( b* w; r/ |. P' E# i5 i
  70. dma_addr_t dmaphysdest1 = 0;' M2 E% {! T/ Y# ^, {6 _
  71. dma_addr_t dmaphysdest2 = 0;, }& }" T  d) D/ r# H( @

  72. ) L. l# M3 ]  B" t% n9 @
  73. char *dmabufsrc1 = NULL;: x- J: C5 @- Z* K5 @3 h; w4 \
  74. char *dmabufsrc2 = NULL;8 r- l( T0 w' `; t& G: f
  75. char *dmabufdest1 = NULL;
    * @7 [! q) x* V9 @0 I7 l9 [. T
  76. char *dmabufdest2 = NULL;
    + E; }! I, ^- }) X4 B5 _. e

  77. ( s( [  F. D" F/ i3 Y3 c" a
  78. static int acnt = 512;  Y# r+ E9 R1 N; W7 ^
  79. static int bcnt = 8;
    2 q- d, R& a& r4 I8 g) ?: T
  80. static int ccnt = 8;0 L, r' E/ o+ G6 E
  81. ! r5 d. L, c8 g9 l& C9 p' S+ p" B! U
  82. module_param(acnt, int, S_IRUGO);
    3 A* ?5 J7 e2 \9 q3 Z! {& q
  83. module_param(bcnt, int, S_IRUGO);& k8 A7 x9 }/ N9 N/ j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  {4 z+ [$ \. P, r3 S% o: E
, H* n" w' X) ^3 A' |6 S: [4 A6 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' c5 ?6 l. Z1 h  _* q- ^& P# |+ e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 J, ?% z5 Y5 Q( J1 x  X& j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 q  C# t# r3 K9 i
% l0 Q. B$ V" Y! N9 o2 a" m$ E: i5 p- K( `/ b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 12:56 , Processed in 0.044536 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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