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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % j1 o' `" G' M0 d- N
  1. [code]EDMA sample test application
    2 [. J- _* ^6 b4 v
  2. /*5 k  R0 ?% X' V8 M* f
  3. * edma_test.c
    - K$ g, W9 s  ?; j+ \
  4. *
    - a. e+ ~, V' F5 i3 K
  5. * brief  EDMA3 Test Application
    3 D4 z* ~: n. `* `3 P, n/ M
  6. *
    . t" x+ C. d# r
  7. *   This file contains EDMA3 Test code.# G* J7 {$ z, ?, |% F) S9 r
  8. *  F+ Z6 G; h0 B! n* ]" t0 J/ i. s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 |' l6 m8 k  e* r1 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 h, }+ a' ?, F2 _
  11. *         TO CHANGE.9 @  \6 F  k7 G3 ?
  12. *
    7 C1 ]- R- p; \* L& D. Z- h; c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ^; T) V& M' D, P% V1 Q4 q2 u
  14. *
    ! p/ W7 j2 p# f/ D2 L
  15. * This program is free software; you can redistribute it and/or
    9 w. ~. J& w: L. P; u: ~, I
  16. * modify it under the terms of the GNU General Public License as' v- }  ^+ v/ k# G$ ?
  17. * published by the Free Software Foundation version 2.
    . o* I- N( _# }
  18. *5 H4 Z$ _' z: X8 W1 P8 U: _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 a  x6 {- d$ ]
  20. * kind, whether express or implied; without even the implied warranty
    3 t0 F' f4 J' p% c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " v+ z/ Y8 z; S- K
  22. * GNU General Public License for more details.
    ( x% t/ T- M9 m0 H# t, e# w: n
  23. */
    % {3 C/ E: D; A9 C
  24. + Q. z, E" e* _+ Y9 I5 [; y
  25. #include <linux/module.h>6 C, _3 |4 h- B% ]! M; t
  26. #include <linux/init.h>
    $ d+ g3 y! T$ F; W; S
  27. #include <linux/errno.h>
    # I! q* g# k, m7 B
  28. #include <linux/types.h>
    3 b' y4 E: ?2 n; W$ A( g  J' z! w1 p1 i4 h
  29. #include <linux/interrupt.h>. Z& ^9 }5 i3 @. E" L) [4 ]
  30. #include <asm/io.h>
    4 r1 I+ O/ }  V  y
  31. #include <linux/moduleparam.h>
    8 f, m  K& j& \8 b! d
  32. #include <linux/sysctl.h>+ p/ m4 {6 V6 ^( w# l# ]
  33. #include <linux/mm.h>
    7 |9 b& z! ?; _7 m( F; i- |
  34. #include <linux/dma-mapping.h>; }6 W' {& H" S, I* p

  35. # p  Q* N, `& Z% H$ }
  36. #include <mach/memory.h>; [3 p! |- S' g* m4 Z
  37. #include <mach/hardware.h>
    ' |0 Q/ }$ E# N% M- H% q  r
  38. #include <mach/irqs.h>
    # x& g' A7 v5 B8 M. J( v
  39. #include <asm/hardware/edma.h>( J+ Y$ _7 \# [6 E1 d0 [2 i
  40. $ W+ @4 G, a( R/ n
  41. #undef EDMA3_DEBUG8 c2 G" \+ B/ w5 a. z
  42. /*#define EDMA3_DEBUG*/2 _' x3 @) Y3 C2 s0 P, E/ X4 e/ l

  43. / V6 _8 X6 C  _+ p: R( t
  44. #ifdef EDMA3_DEBUG% g  s% S3 A  a- p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); f  W3 T/ J8 i1 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D& E9 T1 V' \* t; D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 M6 @& M0 }; R( h) |5 l
  48. #else' P) d0 c3 f6 e, S4 O
  49. #define DMA_PRINTK( x... )3 ^; T, _) H' a! G
  50. #define DMA_FN_IN
    ' g/ o7 U5 n+ m% H' S) |
  51. #define DMA_FN_OUT1 ?2 `5 Y/ h2 I
  52. #endif
    0 c8 k9 O1 A' e) d- v
  53. / K) F+ F$ E# S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* H5 G' J0 ]; k7 `7 w  F
  55. #define STATIC_SHIFT                3
    ; n% Z  @4 r2 @7 V9 l( Q2 t& `$ B
  56. #define TCINTEN_SHIFT               20
    4 y, G* j2 o# ]9 N2 M/ Y1 L' O9 b
  57. #define ITCINTEN_SHIFT              21
    5 F8 b9 `$ @, x1 T
  58. #define TCCHEN_SHIFT                22: ~( f0 x: o* C7 t( l0 U5 D$ K. f
  59. #define ITCCHEN_SHIFT               23
    " I4 e: t5 i; u  t& H+ P# ^1 ~

  60. $ \% p7 L0 q, C& \# e( ~
  61. static volatile int irqraised1 = 0;
    3 {% R+ `! q* i7 k$ k! \8 L. j
  62. static volatile int irqraised2 = 0;
    % t6 J  V. S+ P- X- t9 A: G/ z# h9 a0 s
  63. ! B9 Q1 `5 ~! j% E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; t; a0 q# g; C- V1 {' v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P. D, z0 q( p: k4 \% m3 l6 @5 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 y7 q0 m- Z6 [8 ~7 n& y6 G" x

  67. " [& ]. }; ~( L. g6 m
  68. dma_addr_t dmaphyssrc1 = 0;) C0 ?9 c0 H" m7 o
  69. dma_addr_t dmaphyssrc2 = 0;
    0 i/ d, q: k/ ]& `% i3 x
  70. dma_addr_t dmaphysdest1 = 0;: J( B" [) z  D% v( P/ ]4 H8 C1 C8 ?
  71. dma_addr_t dmaphysdest2 = 0;- G3 R) J1 }) S1 v

  72. . F1 U& t' Q4 O! A
  73. char *dmabufsrc1 = NULL;
    3 f" ?- m$ }3 o
  74. char *dmabufsrc2 = NULL;4 B, x! ?$ C  s2 A
  75. char *dmabufdest1 = NULL;2 G7 g* T4 C( S' n: i% c4 m
  76. char *dmabufdest2 = NULL;
    " ?# k2 D/ i% d/ F# x6 _9 P0 f
  77. : ~" J* E: X* u/ U4 R2 i; l3 y/ D( C
  78. static int acnt = 512;' h, t& a3 [# a, T/ d8 z
  79. static int bcnt = 8;
    , V& b' O# e$ l' ~. D; c
  80. static int ccnt = 8;
    ! y; j! }! ?. K3 R5 x$ `

  81. 6 U+ z) b8 ~9 Q/ m# y
  82. module_param(acnt, int, S_IRUGO);2 H: r4 j( b  t% [
  83. module_param(bcnt, int, S_IRUGO);
    ) d$ I& F# J; T: I# `* G7 W; [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 X0 @5 @7 Z2 U5 g2 u" v/ |; X! H
2 W+ J8 t  U) E6 E  E; Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: \) g- Y& c1 Q' Q) c( Z7 v% f& j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" R) X2 T# F4 n9 t9 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  d! f" `4 p1 ~) d2 X8 `' d! U" |+ }) I
$ L; t3 B0 z* `: _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-24 20:42 , Processed in 0.048337 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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