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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ~; X8 O8 {* \" p% c
  1. [code]EDMA sample test application
    ' s7 s0 J  g! n$ T# ]1 d
  2. /*' i4 O+ ~" I/ m* i3 y% z* e* @
  3. * edma_test.c1 T( i; Z6 }& s7 v5 ?( v) q7 H
  4. *+ U, S5 n, B& M# H6 d& x
  5. * brief  EDMA3 Test Application) x8 L1 A& H* f; e3 X* ?
  6. *2 a. |4 M% p9 N+ k7 ~
  7. *   This file contains EDMA3 Test code.' \" ^- M7 T6 L
  8. *
    ; f2 U: }- [1 `, c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! {$ ]7 D& F2 q1 k) _0 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + g. `7 H, F; r7 K% `% W
  11. *         TO CHANGE.
    7 _' a$ j+ F$ ^8 S
  12. *  [+ c' C/ ?% p3 D! K. F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ]3 W9 [0 l$ R4 I; I  o0 d
  14. *# w- L( C( u, F2 G0 Y
  15. * This program is free software; you can redistribute it and/or% v, a( y/ u' e/ |+ B* h2 s
  16. * modify it under the terms of the GNU General Public License as% i$ y. G% h8 Q0 w
  17. * published by the Free Software Foundation version 2.
    ; B2 l, D2 I& F/ D
  18. *- C  x0 R8 a7 y4 W/ i' M# l" C/ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + _+ w/ G$ o3 z) ]+ S
  20. * kind, whether express or implied; without even the implied warranty% Y2 E7 d7 p- \3 V3 \3 V5 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( P6 s: m3 t, W5 ^! `4 A7 D
  22. * GNU General Public License for more details.. H) C1 \; n/ e  k6 J
  23. */
    : ^: D7 J9 t& J( L9 r& V' F0 @* s

  24. $ ]( d- X) ~2 `# M
  25. #include <linux/module.h>
    " K: G% {. D/ i7 ]; t: |
  26. #include <linux/init.h>
    4 F4 t% b& Y6 ?% n( m8 h  i9 w
  27. #include <linux/errno.h>' p6 ]" n! A5 \2 g# p' U0 I
  28. #include <linux/types.h>3 ^- \2 j3 Q0 h/ n# @
  29. #include <linux/interrupt.h>
    1 m5 Z0 J3 C6 D, f$ @, n% m
  30. #include <asm/io.h>
    ) g" j9 k) N- s4 z% O3 _
  31. #include <linux/moduleparam.h>
    % W3 H% l5 u- a3 Q
  32. #include <linux/sysctl.h>
    3 {1 U& A0 {" T$ l
  33. #include <linux/mm.h>9 i* `, j) A% F& a% i/ n
  34. #include <linux/dma-mapping.h>' R: I6 T  @1 g! G( {; u
  35. . q. e7 r9 q# E: S2 q
  36. #include <mach/memory.h>
    5 E( |  X9 |5 E
  37. #include <mach/hardware.h>6 y3 _4 I4 O; m3 _; b; V4 [
  38. #include <mach/irqs.h>9 p9 D" H! U$ r2 ]1 n
  39. #include <asm/hardware/edma.h>
    ( e' q. |1 W6 g9 h( s
  40. 3 A" m7 F6 x( G
  41. #undef EDMA3_DEBUG7 v( ]" g, \) e7 Z5 `) c; h* _
  42. /*#define EDMA3_DEBUG*/# Y/ C1 l$ u5 C3 V+ u+ M
  43. 5 b, Y5 m. q" m, M* H
  44. #ifdef EDMA3_DEBUG
    8 G- A" b2 i( }7 \4 C6 V$ S3 ?3 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 T/ i) n9 N- C0 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % u5 B1 s) @$ f( L5 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 M& c: U% X; o* S' [
  48. #else  {3 N7 |  t" H9 ~
  49. #define DMA_PRINTK( x... )9 Y7 n( X0 K) N: {: i8 }- T
  50. #define DMA_FN_IN! L! l1 l& l* x( J( J8 V4 y
  51. #define DMA_FN_OUT7 F6 f" z. ^' s, u- ~0 X9 ]
  52. #endif0 \3 e7 e% s  ]5 O2 i& l
  53.   x# y1 J& s! A, N2 f% P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# W9 @/ v; w- }0 P" d) s& C
  55. #define STATIC_SHIFT                3
    . |& C+ E2 R$ ]: S4 R
  56. #define TCINTEN_SHIFT               20! N! |0 P* V6 |/ Z
  57. #define ITCINTEN_SHIFT              21
    4 n0 v6 S' }# B! j7 X$ _
  58. #define TCCHEN_SHIFT                223 l; X& D. t) A
  59. #define ITCCHEN_SHIFT               23: [/ b3 r8 z+ k. ^9 @/ X" M

  60. 8 ]" {! U! {( w4 K
  61. static volatile int irqraised1 = 0;' ~% r+ v7 x1 \( _3 V% X& P0 B
  62. static volatile int irqraised2 = 0;
    : g% @* d0 `$ D) m- I+ u

  63. ) E+ T6 y5 ?& [6 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k$ H- ~( t6 w+ d- ]4 A, \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V8 Z& w9 x+ T4 @) U3 @* ]$ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q. _% o, b" M( Z, ]

  67. 5 S( W& V$ o/ k  k* e
  68. dma_addr_t dmaphyssrc1 = 0;
    / r# E) x& |3 }% i1 ]" U1 G6 o& u
  69. dma_addr_t dmaphyssrc2 = 0;
    . {7 L( @7 x# L* r7 M
  70. dma_addr_t dmaphysdest1 = 0;
    & T- S, N: Y  ?+ H* b0 T6 v
  71. dma_addr_t dmaphysdest2 = 0;
    ! @1 T5 s2 ?1 w! e* \4 ]
  72. * t# e2 y9 v( g9 w+ s
  73. char *dmabufsrc1 = NULL;
    ; {! }9 q/ O" D' \6 g
  74. char *dmabufsrc2 = NULL;
    + }' h3 ]: w  T" g  g; o1 Q9 L
  75. char *dmabufdest1 = NULL;$ B( H) a) Y% W) T( f/ a. o1 T9 o
  76. char *dmabufdest2 = NULL;
    8 l% V( t( ~# y% L8 n* U0 e
  77. 4 d% V% Q2 i  z4 @
  78. static int acnt = 512;8 L. x" ]1 C% O5 N
  79. static int bcnt = 8;1 o3 m- I( N. {9 H
  80. static int ccnt = 8;
    ! [( v! a  M8 f+ ]" N

  81. 2 a8 Q: I, e, X; M) ]: P
  82. module_param(acnt, int, S_IRUGO);
    3 x# C! R+ J$ [1 s, Y; w4 u
  83. module_param(bcnt, int, S_IRUGO);
    ! H+ d" Z% {+ P: D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% S, B* a" y! A( i! \
  t  R0 m8 l% o+ O$ ~: M4 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W' t$ ^6 y7 A+ W1 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M- P$ h8 Q% a& a! z& M# z5 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 K' H1 K! y) ?) U* N2 `. ~0 V6 ?
5 W" O6 r9 X2 k5 U! R

3 o9 n0 \2 t9 q  b7 |  O/ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 17:18 , Processed in 0.048129 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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