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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- D2 Q5 `7 R' a* o2 e; ?) |) Z
  1. [code]EDMA sample test application
    / V4 e9 Z+ u# C) a# b0 {
  2. /*/ P2 F: u2 j/ ]+ A, e( P
  3. * edma_test.c* @4 ?5 @, y( Y
  4. *
    6 S2 ~3 C5 S+ a7 Y4 g" r
  5. * brief  EDMA3 Test Application* A( S' X0 W* c9 V' }2 H0 ?8 a
  6. *
    4 v+ }4 E5 ~- _- }) F/ u- M( `" d
  7. *   This file contains EDMA3 Test code.
      ^/ k- ]9 u& E. I5 R
  8. *- M7 u2 R+ Q0 P$ m5 p6 R0 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % N  N0 e/ \" J: l0 ]+ w4 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 {1 [. l/ e( t4 U+ m( ?
  11. *         TO CHANGE.+ F! T- Y" R2 H+ b4 A9 P
  12. *& p  P  l; K8 o" e& j7 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' \* k' O8 ]. I4 N
  14. *
    1 Z5 b/ ]9 s) n5 c4 `
  15. * This program is free software; you can redistribute it and/or
    2 ]) t0 m2 }$ y0 k4 x
  16. * modify it under the terms of the GNU General Public License as4 @/ [" d- X8 r$ ?
  17. * published by the Free Software Foundation version 2.( R1 a& K" v2 J4 g8 \
  18. *
    & l4 H; {  B) }4 g/ l- N, J5 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ]& z3 q9 J8 F( j6 U
  20. * kind, whether express or implied; without even the implied warranty
    7 }3 f) e" I% [9 S2 j: L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . r8 v6 k, z9 Q: ]
  22. * GNU General Public License for more details.
    ; M; m( h; P( l+ W8 B
  23. */1 \9 F# a$ Q+ z3 r

  24. % r+ y$ J- p7 M2 U. W9 R* I
  25. #include <linux/module.h>6 C% I% x( d% P7 _6 k$ a
  26. #include <linux/init.h>
    . a/ R- y- _6 w6 e4 w6 V3 u3 M' q" h
  27. #include <linux/errno.h>
    " w5 ?, v7 P9 ^! i
  28. #include <linux/types.h>* a" C2 P% z4 e# E0 {1 M# Y7 k$ g
  29. #include <linux/interrupt.h>, O7 H- Z. y7 [/ @
  30. #include <asm/io.h>8 {/ f% ^& B4 ~0 V1 m7 X) w8 A
  31. #include <linux/moduleparam.h>" V# W# S( e# P: R2 ~
  32. #include <linux/sysctl.h>, l: {' G  r2 y
  33. #include <linux/mm.h>
    1 y( U& E2 a' G6 F6 w: \1 G) L
  34. #include <linux/dma-mapping.h>: s8 `' _' p1 a. S) r  H# A

  35. 2 J6 ]' h& C0 p: ^
  36. #include <mach/memory.h>
    ; t: r0 f" I' F* z: x
  37. #include <mach/hardware.h>
    ' M3 Y; B- r# Q* b/ N" F' |
  38. #include <mach/irqs.h>+ h& ]+ w4 c2 l$ w( g5 }% T, O
  39. #include <asm/hardware/edma.h>
    : k$ R- q6 a% ~1 K; L
  40. ) t4 |+ U: K, y! G, n# w: b* k
  41. #undef EDMA3_DEBUG
    " H3 _' w" P+ k6 C$ i7 J5 y
  42. /*#define EDMA3_DEBUG*/  ]- ?3 g+ H3 c9 h% }/ a

  43. * S! A6 N% y6 i! W) h
  44. #ifdef EDMA3_DEBUG
    ' g. k5 K1 l$ a( `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 S' O6 z& ^3 q2 J0 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 \& n7 y  z5 R' d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 p' \0 D5 s9 l
  48. #else
      m- a  R8 q" B; p; t
  49. #define DMA_PRINTK( x... )# m: w  L; W8 q. Z+ a/ a2 }9 ~
  50. #define DMA_FN_IN; K( M* S: X0 v/ C
  51. #define DMA_FN_OUT
    % x6 C% \' M/ ]% T; h
  52. #endif
    ( o. h& N, K* H3 j' f

  53. ) p9 _5 v: f0 S; J+ {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), |% {: i& V8 L+ v
  55. #define STATIC_SHIFT                33 k  k! `! @6 r
  56. #define TCINTEN_SHIFT               20; M5 E8 q  `( H
  57. #define ITCINTEN_SHIFT              21* L. j; E: I" V8 p& _/ g) [% n; M
  58. #define TCCHEN_SHIFT                22
    " _0 x. ]  h, z. C( p7 v7 X$ Q
  59. #define ITCCHEN_SHIFT               23
    , W7 L; b$ `9 j) [

  60. 2 h; {' t: F- v, ]
  61. static volatile int irqraised1 = 0;
    ; a/ m4 d. X8 y) I8 L
  62. static volatile int irqraised2 = 0;2 M. y' @& m/ Z2 u
  63. . n% p! }* m2 O4 n' O& f5 }/ ]& g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f0 r$ n- `, f/ b2 {" ~  n  Q" V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# T' o1 b& u& E" o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ^( d% c: _  }  t% t" C3 T3 F8 f( @

  67. : Q  E  d4 }5 b1 t
  68. dma_addr_t dmaphyssrc1 = 0;
    # `+ ^& ]6 Y5 V, r7 z9 q
  69. dma_addr_t dmaphyssrc2 = 0;$ H4 c: y% l/ ]# o6 f* t9 V
  70. dma_addr_t dmaphysdest1 = 0;
    2 D8 v, s5 E0 z/ ?) r7 \
  71. dma_addr_t dmaphysdest2 = 0;
    1 U" @( k# X  ?5 r; Q
  72. 4 [* c) X. K5 R* P8 n
  73. char *dmabufsrc1 = NULL;* M1 t' }1 ^0 h: R
  74. char *dmabufsrc2 = NULL;8 x4 C* F9 x: z9 I( e$ T
  75. char *dmabufdest1 = NULL;
      x2 Y% b' `3 q' {
  76. char *dmabufdest2 = NULL;7 ^) e2 {+ e0 [# \& _
  77. ; U- _1 l- s' K
  78. static int acnt = 512;
    % ^- t2 F- B/ k1 j! G6 b
  79. static int bcnt = 8;7 t) u( Y* r" X
  80. static int ccnt = 8;
    , ^( X! f$ K! s! ]. W& P1 t

  81. 5 j* A8 E. ]1 v7 H, K
  82. module_param(acnt, int, S_IRUGO);
    , b6 P. e+ h5 W; G! Z7 z, J, t7 r
  83. module_param(bcnt, int, S_IRUGO);: B! [2 F& ^0 s! B7 s6 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- y: M1 o9 h# L- \

1 h) h7 H% G6 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K1 c' s, u1 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( N3 w" ~* Y  e) C$ l' H7 r3 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- `3 D4 I9 t. Z. E( D& x, n0 u
2 o# k2 k* c$ F& L7 s
& C5 F6 \8 v1 s' ?' k# ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 06:25 , Processed in 0.047191 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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