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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 W# z) k6 j" P& P# b1 ?
  1. [code]EDMA sample test application
    3 a' V) x( P8 _
  2. /*5 u4 |4 ^1 c# u8 Q- z; h: D
  3. * edma_test.c
    ) \) I# W8 J0 E6 e$ t
  4. *$ R2 W/ H& `  F  p3 z* T0 q* `1 g8 O
  5. * brief  EDMA3 Test Application! k3 I1 a8 Y. z5 c) c& R. H
  6. *
    ; t3 n0 m0 o7 p% Y
  7. *   This file contains EDMA3 Test code.
    7 s4 u. E. k3 F' @
  8. *
    ) I0 [& ^6 _( j, v; r# {$ R- L' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " Q* ?# m2 z# [' X+ Z* Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 S: ?' @' r) ?
  11. *         TO CHANGE.; Q& v: t2 w% X7 G* }7 ~
  12. *
    ) s  [- K, L* q$ \7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! P4 c* u) F5 b5 w
  14. *. `% I& ~0 \0 b8 i
  15. * This program is free software; you can redistribute it and/or, `8 K4 b; r1 U( P6 x0 t
  16. * modify it under the terms of the GNU General Public License as
    & [2 R2 e1 Y$ d2 r4 ?
  17. * published by the Free Software Foundation version 2.7 \3 P! @( T$ ]1 h# ^4 j0 [* g9 w
  18. *" _+ l6 W* H& T6 I3 ^. n$ J: p4 ?" [  p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 _" \, r) V/ V# H
  20. * kind, whether express or implied; without even the implied warranty$ V4 {, Z7 k# M6 S4 g6 ?3 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ R+ O+ B) }* s+ ~2 S& ]  L# ~
  22. * GNU General Public License for more details.. K1 U5 c4 {; x* k
  23. */4 \0 b$ |* D  v. n0 l, o+ A9 C" v
  24.   g3 N7 d: _; p2 z" E0 d* P
  25. #include <linux/module.h>7 o* `( P2 N% B# F9 x* B6 f
  26. #include <linux/init.h>
    # t; g! x: K( r; _
  27. #include <linux/errno.h>
    ; ~# R8 b" \( q0 p; W; ~
  28. #include <linux/types.h>4 h5 q3 Y% F* v
  29. #include <linux/interrupt.h>! I/ v0 l* C6 h# }3 t" b
  30. #include <asm/io.h>7 e! G. x8 g9 l. K, f* F
  31. #include <linux/moduleparam.h>
    ! X" p* X9 S( S) ?
  32. #include <linux/sysctl.h>+ j0 j1 j) @3 v% j
  33. #include <linux/mm.h>
    . C/ w" `& H# N( B, W
  34. #include <linux/dma-mapping.h>( J& }  C. g4 _' @$ m3 j8 M

  35. % V" A6 A5 k0 S
  36. #include <mach/memory.h>9 b2 D7 }$ `  Y  y
  37. #include <mach/hardware.h># d; n! Z" h0 y- y* e) G4 ^
  38. #include <mach/irqs.h>
    / o2 `6 K$ {: P! q
  39. #include <asm/hardware/edma.h>
    , Q" o0 T" B/ J( r+ m5 V- \5 I6 V$ V) c

  40. 4 [: I" x, P+ h
  41. #undef EDMA3_DEBUG; l5 H& t# R# `0 L6 r6 G
  42. /*#define EDMA3_DEBUG*/
    / f4 b9 p0 W3 Y! K
  43. ' m$ A! q: `+ o, X" j& z1 V
  44. #ifdef EDMA3_DEBUG) {: n1 Q# p5 g& z$ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 [7 B4 g( p$ d* G# y$ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 D8 J$ |3 z& l& F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & W- e7 _  l: A3 r- l6 ^
  48. #else
    % G4 h9 S( {5 y+ Q
  49. #define DMA_PRINTK( x... ); S- i. b. y. g  \. J+ t
  50. #define DMA_FN_IN. n) ?! \2 `3 m3 E2 T
  51. #define DMA_FN_OUT
    9 X  U3 v1 D  r. |9 y
  52. #endif
    : y: d7 l( e4 p# P0 [* a1 W$ j

  53. ' D4 M$ V* G$ G) M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( `* R- W* q; t  N! W5 f
  55. #define STATIC_SHIFT                3
    . s$ w1 h6 C% d. G" v
  56. #define TCINTEN_SHIFT               20
    ( {0 L0 ^1 U  [: t$ ~4 C8 s
  57. #define ITCINTEN_SHIFT              21" L/ w9 O- x# R. [
  58. #define TCCHEN_SHIFT                22
    4 p) x$ d: k: m3 W2 M
  59. #define ITCCHEN_SHIFT               23
    , S& F! N* w. p9 |
  60. , u( N, M. t+ A- E2 T$ {
  61. static volatile int irqraised1 = 0;
    & D8 W4 G9 h) m. q; ?, B) f& e
  62. static volatile int irqraised2 = 0;
    8 _, P  t4 }4 P9 {$ S# l
  63.   J- a% M. w! Y8 y4 }2 w. k3 @4 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( v* W1 s$ w, |* n& f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x' U% Z, d/ V$ y" D6 ~; r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 R$ M9 v! p/ `' b( e* |
  67. : Z. e( n2 a" t' w& o/ O
  68. dma_addr_t dmaphyssrc1 = 0;
    - k5 `, e$ K8 s# R- m5 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ) _) u  v) h9 n+ B4 a( M
  70. dma_addr_t dmaphysdest1 = 0;
    ' T& s% ]& n, ^$ y# r
  71. dma_addr_t dmaphysdest2 = 0;
    1 l' f1 g' Z7 i4 K% r8 Z& i9 P
  72. # u7 E' e* f0 p% Z- C/ D
  73. char *dmabufsrc1 = NULL;8 e. \" n# w! t3 W, S" L, P
  74. char *dmabufsrc2 = NULL;( w4 B# I0 q( V9 R1 C6 w! u8 h  `
  75. char *dmabufdest1 = NULL;2 `0 C* h. y" M: M/ {; m9 v% U$ W
  76. char *dmabufdest2 = NULL;
    " i& G. i7 q$ m8 F0 X# D
  77. % w  N5 g1 s- Y8 m7 f  y
  78. static int acnt = 512;0 z4 i% W; X; I; F# O5 Y/ K
  79. static int bcnt = 8;5 K! Z9 @8 ^+ s) e( M% r5 u/ l
  80. static int ccnt = 8;# t/ I! j# E9 V4 l+ a1 f
  81. , r" {" F. X  I6 {# [5 l
  82. module_param(acnt, int, S_IRUGO);+ k: ^1 L! U) h; i5 l
  83. module_param(bcnt, int, S_IRUGO);
    9 g) W1 t% O1 R8 P. a( h& a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 g/ Y! w& w3 l: B2 A  ]0 \/ L3 p9 S' X# f3 H, H4 I. c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, R: h! `- k1 i: `+ o  A2 k8 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 S" b* X; Y; H) `& S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ R" t  \; R2 O  b: P* x4 j! y) d+ }
! l" o8 \, q3 {* }) G' n0 U
9 V2 P2 q$ _; a9 ^1 z* ?" D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 10:01 , Processed in 0.043548 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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