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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % A# W  t, E5 L# [
  1. [code]EDMA sample test application
    8 @, [& {  X" p3 c) z# P; W
  2. /*0 f( c9 \- c- D! [! b6 S
  3. * edma_test.c
    $ Z1 O+ m2 `, O3 z4 J
  4. *5 w( I: B* K( h% v2 S3 q( T
  5. * brief  EDMA3 Test Application
    . o4 a7 w% K* b( |. ~$ T3 n0 Z+ ^
  6. *+ G+ g1 D4 @) Z! x& }0 x. S
  7. *   This file contains EDMA3 Test code.
    ! Y# `- V" q8 j4 A9 V8 W8 w
  8. *" D$ A% ~' ?$ A/ {4 a2 z" ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ], q, I0 m- B+ w6 ~* c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! S" s% w( T# U
  11. *         TO CHANGE.1 h. l! ^$ c6 J$ d: b, I, D
  12. *
    " n$ D7 y  P6 q# \% n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& y/ Z( ~9 p9 h
  14. *
    3 C' _* M' p# T4 M
  15. * This program is free software; you can redistribute it and/or
    7 R, w5 G4 V% W7 S$ @
  16. * modify it under the terms of the GNU General Public License as: I* D& E3 S. @5 m+ J! R
  17. * published by the Free Software Foundation version 2.; L2 j- Y8 x, {( n5 Y4 ~9 r
  18. *5 l3 N& t( X: t' I& L  E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " `' u0 g4 {+ y- |1 O
  20. * kind, whether express or implied; without even the implied warranty7 M- m. B7 v# u, x3 l2 m6 ?& u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 g; r4 ]% {3 W/ K1 w4 c1 W* e" s
  22. * GNU General Public License for more details.
    7 |2 N3 l, `, m( w
  23. */( k( n2 X% d2 U4 B5 a

  24. ; ~# s7 u8 s5 v8 J: h# D6 E
  25. #include <linux/module.h>
    , S8 ^0 ^2 y' n: Z' c
  26. #include <linux/init.h>
    ) l+ c8 {# f& J+ e& \0 U
  27. #include <linux/errno.h>! y4 E! V" n5 B6 O" r
  28. #include <linux/types.h>
    0 W0 p- x( r5 M* R8 r9 t
  29. #include <linux/interrupt.h>8 P/ Z, {7 k* i
  30. #include <asm/io.h>" D0 x; f) x7 t
  31. #include <linux/moduleparam.h>! e+ Z0 G3 `1 o3 S% r1 m; O0 N
  32. #include <linux/sysctl.h>
    ; O, z' m; f# a; U# L9 D
  33. #include <linux/mm.h>
    . _0 \4 J2 o) V, D; n& u( ?3 M
  34. #include <linux/dma-mapping.h>" B( g# N: }! v. |9 ?

  35. , X8 I2 ]1 Z' P5 N9 y! @5 ?
  36. #include <mach/memory.h>
    + a# g0 ~: e1 ^& D  M' i4 e
  37. #include <mach/hardware.h>
    , H' C; R/ [* H( ]' c) T
  38. #include <mach/irqs.h>' b$ E! t8 D; {9 h7 b( A
  39. #include <asm/hardware/edma.h>* O6 {$ d3 f5 Q2 T" N) v
  40. 4 U/ p% ^$ E0 D7 y6 ]/ }
  41. #undef EDMA3_DEBUG" Q+ O9 k* Q- c1 Q: O+ b% g
  42. /*#define EDMA3_DEBUG*/' e& v9 e" R: F; z# y+ Y- F
  43. , g4 a+ {8 O! ]! E
  44. #ifdef EDMA3_DEBUG
    # W) ^2 y% q' C/ p. C* t" o- j2 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 `% k3 x2 [" c+ ^6 ^4 W7 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ?$ Q! z% C2 x" B- T0 \" E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 E: O5 P: z6 i: N
  48. #else* B8 ?. A1 P7 U& a' d: q" m1 i0 f% i
  49. #define DMA_PRINTK( x... )# M4 H$ Y) _' _$ t7 K4 W
  50. #define DMA_FN_IN
    - X3 }' x: [$ C' K/ m* S* Z
  51. #define DMA_FN_OUT
    6 K$ {7 |6 n  Z+ a$ g
  52. #endif- S; e  H, ^3 ?+ ~2 Y
  53. 8 P! n! K3 E4 J* R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! M& E8 X- n4 s5 x. w' L* @3 y7 o
  55. #define STATIC_SHIFT                3# s& e9 ]* w& ?( y# C/ F% @
  56. #define TCINTEN_SHIFT               20( b8 n: g" H/ W6 [% e
  57. #define ITCINTEN_SHIFT              212 L) {  B6 g5 g
  58. #define TCCHEN_SHIFT                22( n' S7 H0 e; h8 y! N3 w
  59. #define ITCCHEN_SHIFT               23
    2 T4 E$ G2 H$ n8 x; p# [/ d

  60. & h1 Y, Z  g) K# h1 h
  61. static volatile int irqraised1 = 0;
    , g" k* g" Z" V) |1 s
  62. static volatile int irqraised2 = 0;
    . }& B* |* D* L$ w9 J% C

  63. 5 o' K! n; z2 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o& y% p1 P/ a) j8 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h0 \1 D' ]) r! j3 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?  c7 Q! N% d, U8 |/ Y
  67. ) }# C; k: L/ C7 K" V3 r
  68. dma_addr_t dmaphyssrc1 = 0;" v  O  K) [) d8 i; z7 f
  69. dma_addr_t dmaphyssrc2 = 0;
    ' v# S- C. Z- \; K
  70. dma_addr_t dmaphysdest1 = 0;; x: R# s0 f' K$ m
  71. dma_addr_t dmaphysdest2 = 0;
    + @1 I& h: c: F' L0 \: i8 U$ n

  72. * E5 \3 [0 w  X5 K& g' Q
  73. char *dmabufsrc1 = NULL;
    ( L2 u( |- q  @2 t. Y( ^1 o0 [
  74. char *dmabufsrc2 = NULL;
    6 c( V# \4 z1 y8 i  p+ N
  75. char *dmabufdest1 = NULL;: G, Z8 K. z& ^* L8 [! r
  76. char *dmabufdest2 = NULL;
    4 ]- J/ d, C4 r3 J! ]/ ]4 G

  77. ; R+ i% A+ J/ q+ z9 f+ o
  78. static int acnt = 512;, Y+ r( s* }3 A: _: I7 ?! Q9 ~( U0 R
  79. static int bcnt = 8;$ f1 j, ?2 E/ d" ~) i. R+ D
  80. static int ccnt = 8;; O  |. m2 f0 R" T
  81. 4 I( z! Q3 T+ i. S; ~* U, [
  82. module_param(acnt, int, S_IRUGO);. I2 i; k# Q3 m) J3 ?1 v% X& q. E
  83. module_param(bcnt, int, S_IRUGO);) j7 F+ L: R, m. Z  R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# U% q8 {5 r+ P: A% K9 s* Z+ {' A

5 E# L2 F' C& u2 f8 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* s' X! Z1 z; T2 s8 ]4 Q  g$ Karm-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 @( t' L" j8 U0 x" D7 F9 j8 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 W& Y! i3 f2 `, E: R/ ]/ I( G. K" M! e8 {+ |! ^( n1 c! h
* z" {2 u$ l& j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 14:21 , Processed in 0.038821 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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