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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 h: J; s4 f  `. Y
  1. [code]EDMA sample test application
    1 @6 z# R2 g! u7 ]1 d! t. M
  2. /*9 H& I0 ~, O2 y
  3. * edma_test.c6 G: }7 `2 R: |3 h
  4. */ s$ {' P2 a# [2 q( S
  5. * brief  EDMA3 Test Application
    # Y  e8 v( }" J$ v' G
  6. *
    / C2 s* k* p; \8 V; f9 I9 D3 F, x
  7. *   This file contains EDMA3 Test code.
    " n5 l8 \. o, A1 c9 P
  8. *7 G0 N/ v" D4 T9 H- S6 h. M; L: l0 e- b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 r3 }5 l6 ^  z" t* F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      \8 ]% E0 `1 O; A5 R0 X
  11. *         TO CHANGE./ s' v2 d) A1 s5 E
  12. *% i* `7 G) u+ B4 [* y6 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - @* U4 Z3 f# h, D% G
  14. *9 k* O% u# {; Q( y' Q
  15. * This program is free software; you can redistribute it and/or) ~% r8 F& d6 `# c
  16. * modify it under the terms of the GNU General Public License as; L* l, T' M" @8 u* }9 h0 w
  17. * published by the Free Software Foundation version 2./ ~" |7 Z& S# }6 G
  18. *
    " v" ~8 A6 h6 ?( a2 V& r! P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% K) [* ?) T/ _5 T- u
  20. * kind, whether express or implied; without even the implied warranty
    , o4 n. ]8 E! \$ q$ \6 u2 r4 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  D7 M" Y: S; P  y4 b* Z
  22. * GNU General Public License for more details.( s& a  q$ {* v0 |+ k
  23. */* N; j& D; c, Z/ L$ M0 n

  24. ( v: E& Y! O' Q* j" M
  25. #include <linux/module.h>8 r& w( D3 V( K7 K
  26. #include <linux/init.h>
    ! q3 T& J! o. F; X
  27. #include <linux/errno.h>
    ) D: Z- r1 w% Q" T- {# h
  28. #include <linux/types.h>$ {' o2 Q2 s( Y, U2 m6 h0 G. ]% K2 P
  29. #include <linux/interrupt.h>
    % v4 y8 z( w+ B* m, ~
  30. #include <asm/io.h>
    # X; G6 i* p% }
  31. #include <linux/moduleparam.h># w* ~$ R! U6 S
  32. #include <linux/sysctl.h>
    ( U* k1 ?" b8 w
  33. #include <linux/mm.h>
    ) |8 Q9 @, r! G* }# B" K6 w
  34. #include <linux/dma-mapping.h>
    9 @* p" G4 p) r# I4 \$ F

  35.   X8 a* v& J3 _
  36. #include <mach/memory.h>9 t+ e8 r& h3 c" d( D  w
  37. #include <mach/hardware.h>
    7 d  o3 A4 Y0 o$ T6 j3 W/ Q
  38. #include <mach/irqs.h>
    * {5 q. i' P" {6 P3 N
  39. #include <asm/hardware/edma.h>- J1 Y* C8 o9 v3 r

  40. $ t+ K/ m: w2 v- a! ]! C; F
  41. #undef EDMA3_DEBUG- ]8 _0 H2 C9 p0 Q8 A/ j$ ^
  42. /*#define EDMA3_DEBUG*/  I0 d; ?5 ~& h4 m
  43. 4 i; G- f' X% l' X: E
  44. #ifdef EDMA3_DEBUG
    ! i0 w( m' n, u9 ^5 r1 G8 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' H) q; l2 Q" ^7 p$ y) ~$ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : n& i( u4 H& `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      Q; V% G/ s4 `
  48. #else
    7 \# H. a& l9 o- |
  49. #define DMA_PRINTK( x... ): |! o: C+ b4 |2 q2 |
  50. #define DMA_FN_IN
    3 T+ l# n$ s8 {5 T* O
  51. #define DMA_FN_OUT
    ; E: h, ^8 V8 [. [+ Z7 [- g
  52. #endif) H" x4 L+ q' J  T+ e, y
  53. * g& _8 h5 A; b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 h$ y$ F) W0 ?" G( p9 q
  55. #define STATIC_SHIFT                37 m4 D  H$ I( S7 P/ _( V6 D" m/ `
  56. #define TCINTEN_SHIFT               20
    : i. d$ X2 S& U% l: U
  57. #define ITCINTEN_SHIFT              21; z  V3 G8 p) r& P. u6 a
  58. #define TCCHEN_SHIFT                22
    2 M- J- q+ ?' S  M% a
  59. #define ITCCHEN_SHIFT               23& g; M5 c! Q4 ?- r6 D! Z% o
  60. 9 T: R- X+ A! ^
  61. static volatile int irqraised1 = 0;; a4 f9 Z+ [/ n& m2 U0 _
  62. static volatile int irqraised2 = 0;+ W. I3 G* a7 \6 f

  63. ! v6 S2 y4 H  k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B  m5 ^& F( E0 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , F* t/ k" S# \) n; i0 k4 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 M8 h- B% C3 c6 g2 Q
  67. 1 z* n0 Y' S; k# ~8 S( H
  68. dma_addr_t dmaphyssrc1 = 0;6 ~( U7 ~5 N* S- B- K+ j
  69. dma_addr_t dmaphyssrc2 = 0;
    2 X! v/ [  a7 t9 V/ b% m; |, |9 e7 J
  70. dma_addr_t dmaphysdest1 = 0;
      B7 \( q$ F* @% G) h7 T
  71. dma_addr_t dmaphysdest2 = 0;
    2 @# a6 w0 B3 t
  72. 7 f1 c  l4 b' N4 Y9 b
  73. char *dmabufsrc1 = NULL;3 q) t* k. i. p/ x: M7 o, o
  74. char *dmabufsrc2 = NULL;- c( g+ z0 N+ p2 y2 S. c
  75. char *dmabufdest1 = NULL;* z# P: d6 |: [- Y& e
  76. char *dmabufdest2 = NULL;
    , `# u/ k+ J$ n3 n( u& M

  77. ! ^+ S% I: L& J, g/ p4 P/ }8 j1 E
  78. static int acnt = 512;. l* {) w$ Y! |: L% j
  79. static int bcnt = 8;% Z9 V4 Z/ d6 ?# l% j
  80. static int ccnt = 8;. m1 @! g. Z& K2 I$ t" q
  81. ( o2 f. ^( ~, X* r) C& m
  82. module_param(acnt, int, S_IRUGO);1 n( {6 M! w; C
  83. module_param(bcnt, int, S_IRUGO);2 L6 I6 ?  h6 g# {8 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* m6 k  \/ c4 l0 @8 \0 |. o
# i8 ^. C$ M7 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( O: S% O; H, r, o) T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# E, X! E8 X/ z$ @* t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ r) m0 V: c+ d5 u* G
# @% O  R$ B' p, C7 D4 Q

0 g+ E  Q. i( J5 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 08:37 , Processed in 0.041194 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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