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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   P1 \2 @! e) r4 Z
  1. [code]EDMA sample test application
    " m6 N1 g7 z. [+ A* m
  2. /*
    0 J& C  d# r4 n5 o
  3. * edma_test.c( `  W% o# S8 g1 a
  4. *& Q8 l- p) ~( j1 h9 H6 Y
  5. * brief  EDMA3 Test Application
    + T- T4 X; B# A* s5 K
  6. *
    * v  B/ d  Z% y2 S3 ^" d
  7. *   This file contains EDMA3 Test code.
    0 d6 j; S5 m1 p& ?  ]3 A
  8. *
    3 O5 z/ A* B: ?; r( y; U1 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( O% F. T2 u. S) O* @' J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 \/ e0 S: u6 Y4 D
  11. *         TO CHANGE.1 M* X( V8 F' k( ?, Z
  12. *' K: ~" C; H8 M2 m0 o! I4 W9 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% h* z* A1 N5 _- M
  14. *
    , ]% V' m' s- W# `" z: D' v0 P- k
  15. * This program is free software; you can redistribute it and/or
    # j5 A9 Y# X5 [8 ]
  16. * modify it under the terms of the GNU General Public License as6 e) n& y; v1 a7 i! A& t
  17. * published by the Free Software Foundation version 2.6 P/ d* S% F9 p  R( Z* `8 _7 G9 h7 O
  18. *+ u5 U9 I" f; l# D# f: Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' F$ ~3 r6 O/ `, s. G( ?! l$ ?$ o0 `  T
  20. * kind, whether express or implied; without even the implied warranty5 h; _9 Y- }) ?5 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 L# u; L/ ~4 p! v
  22. * GNU General Public License for more details.
    / i7 l# D' D' ?/ g
  23. */
    % j8 z) W- d- X8 Q
  24. $ |# ~3 d4 K: T- L* c
  25. #include <linux/module.h>
    2 `: n# ^* M' d! q, i: X4 l
  26. #include <linux/init.h># `* t, \4 s' h
  27. #include <linux/errno.h>
    7 M7 k2 w! }* c5 F, L
  28. #include <linux/types.h>
    4 g! h: i" \5 ^' w+ ^# _* C
  29. #include <linux/interrupt.h>2 \) a' H6 M$ m/ l5 f" C7 V1 s; z
  30. #include <asm/io.h>
    / ?, n2 T# }/ [; u! y# ~5 m
  31. #include <linux/moduleparam.h>
    9 x" N# w* f% u6 p  x
  32. #include <linux/sysctl.h>
    8 a: g, M& p- ]% a% K
  33. #include <linux/mm.h>% A2 G) J2 G% V/ S3 z2 ^; F
  34. #include <linux/dma-mapping.h>% F: O/ e/ o4 @& i
  35. 3 m, p2 l6 m* v( u" A0 y$ O6 x, p2 q
  36. #include <mach/memory.h>
    3 _$ o6 F) w/ R* c: i5 o7 M
  37. #include <mach/hardware.h>+ g  o5 f* T& m/ B7 o2 ~7 T! u
  38. #include <mach/irqs.h>0 F( N7 g' N' C8 o9 p3 W
  39. #include <asm/hardware/edma.h>7 {! ]% U1 k3 _& Q7 i
  40. & ^7 M! ~1 p% I. m+ R/ r6 a$ _
  41. #undef EDMA3_DEBUG6 B' O$ e1 `& x7 f8 h
  42. /*#define EDMA3_DEBUG*/
    ( Y1 o6 I& K5 f; ^* b' d1 u
  43. ) p& ?/ j' f4 R  v. m3 d# e1 M5 D
  44. #ifdef EDMA3_DEBUG, X' i* D1 M# T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : w3 t* B: Y$ a3 f& l' [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& n$ o  ]  t% U8 Y/ u6 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ A. o' S& V2 A3 \: {- o
  48. #else
    $ a0 G+ h  c* R1 J1 [" s# ]
  49. #define DMA_PRINTK( x... )
    $ Y+ X/ ]+ x8 a4 B' d$ B2 ?2 u0 v
  50. #define DMA_FN_IN& n' ~; Z- p1 L) z1 P& U
  51. #define DMA_FN_OUT7 M; S) z) d5 P0 I7 q2 U0 y
  52. #endif
    9 i+ n7 _, f( @2 E! y: r8 K+ n
  53. ! x2 ]9 U4 z" P% `9 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). A" H/ `& ~6 Q/ D$ Z3 H3 [1 j
  55. #define STATIC_SHIFT                3. F# x5 _6 m# z/ c* F) l/ v
  56. #define TCINTEN_SHIFT               20
    . ^. D6 Z( w! X% V$ E
  57. #define ITCINTEN_SHIFT              21
    . }" b; O, J" E0 z* w
  58. #define TCCHEN_SHIFT                22
    2 k; B% q" z* {3 d7 J& z. r
  59. #define ITCCHEN_SHIFT               23$ Q$ @7 ~, y7 O" Q# D: _7 ^

  60. ( }( g! Z+ z; x3 R' F6 C
  61. static volatile int irqraised1 = 0;
    4 K: p5 u6 r* e+ \
  62. static volatile int irqraised2 = 0;
    5 ?  b' A  U! E5 S  f9 l
  63. 6 P. I4 q+ }; _! q) o* Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ~% k# ?( s% v% P1 f1 p: Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : G& j1 h4 R/ g0 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " {4 J6 V$ Q+ D4 W

  67. 9 l$ b* W, ?- y" L0 _5 y4 l% H
  68. dma_addr_t dmaphyssrc1 = 0;5 G5 ]' x* _, O& |4 p
  69. dma_addr_t dmaphyssrc2 = 0;
    # `. q, |7 B4 G9 Z- r  R# R
  70. dma_addr_t dmaphysdest1 = 0;
    * X4 e- a/ H# B$ j
  71. dma_addr_t dmaphysdest2 = 0;
    " ?/ ^' a- V+ @  v
  72. " V8 n% b! h. E. Q8 G
  73. char *dmabufsrc1 = NULL;( }! ~+ q! Q& {( m
  74. char *dmabufsrc2 = NULL;1 N' O- t, f1 X" @. ~
  75. char *dmabufdest1 = NULL;8 y# D# z- a$ ~0 l5 T+ W2 w5 e
  76. char *dmabufdest2 = NULL;: W$ ]. s  _' w. D# E
  77. # r" F/ R! F& ]2 z. ?
  78. static int acnt = 512;! {! L- V2 d) o) T
  79. static int bcnt = 8;
    - D. }; E! S( X
  80. static int ccnt = 8;
    0 N4 V  Y! F% Z4 |9 ~4 f
  81. & b: ?$ J! U& W+ _
  82. module_param(acnt, int, S_IRUGO);
    0 D* v5 q3 V& _( E7 H+ ]
  83. module_param(bcnt, int, S_IRUGO);
    ; S/ r& v7 K& @) t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ M: m& Z! T7 U  ^3 ^& G. D3 Y& s; U2 T2 }1 `7 `$ }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ J& g* [+ Q% H& ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 G0 v) U/ J0 X# Y; Q1 T5 [* C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V) G5 w" ^2 M+ p

4 @" k/ x. C5 x) g4 Q* v2 Q  i  m/ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-20 10:47 , Processed in 0.043311 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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