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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; P$ [* p8 |( u$ Y
  1. [code]EDMA sample test application! M( D  i+ n7 r4 R! Y* A
  2. /*3 a, K- @) Y( h. }" b
  3. * edma_test.c
    ! K. ^" V. H8 X% e
  4. *6 G( |& b% a# x; q5 k
  5. * brief  EDMA3 Test Application! {" D3 j3 D1 S. }4 S- n0 |: h
  6. *
    / g9 ]- P! b1 @: g6 |" D, `
  7. *   This file contains EDMA3 Test code.4 H9 {1 g- c- x2 k4 ^
  8. *  B" T# J6 e8 Z' B. A: m& g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) \, L2 a  n# h9 \1 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  p7 q( a7 x! P# D# I6 r4 {2 n) ]5 a
  11. *         TO CHANGE.
    & j4 }# z" Y6 G8 i, A$ ?3 I5 k
  12. *
    # K! x+ ]8 S( j! J9 R1 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 U7 K5 v* m; h( z: ]; h- F
  14. *; L: l& x! H& T# C$ {
  15. * This program is free software; you can redistribute it and/or2 G1 |* E, D1 T8 K5 A) J6 c8 X4 ~
  16. * modify it under the terms of the GNU General Public License as
    # M* d/ H  M+ J% n7 h
  17. * published by the Free Software Foundation version 2.5 ], _+ f/ {/ v0 U- B# s0 h
  18. *9 x8 T% B1 a6 s" P; j* ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% r+ L6 H3 X* J) \
  20. * kind, whether express or implied; without even the implied warranty3 \; V& r  e# }! z( a5 p( T" q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " B! t2 h# [9 |; B3 a
  22. * GNU General Public License for more details.9 W1 G/ a6 j, B; {2 g6 k" t9 v. V
  23. */
    * h  {0 z0 J% X4 z$ D5 B' Y/ W8 L! s
  24. % r& [( n1 Y4 z* G! u7 z, e% A
  25. #include <linux/module.h>* D; {/ Z+ n+ V5 q5 Z
  26. #include <linux/init.h>
      \) }8 T' A3 G' e
  27. #include <linux/errno.h>
    ; Y+ g6 X& M  y% S1 ]+ T4 j2 e5 C. Y
  28. #include <linux/types.h>/ [0 @$ I5 J4 H" P. r( M0 k5 }; G
  29. #include <linux/interrupt.h>7 p" R- R- Y. s+ j9 C. v5 s! N
  30. #include <asm/io.h>
    1 k! B( v$ Y- V# t& v: C6 w0 w
  31. #include <linux/moduleparam.h>! J5 {5 w7 e# Z& Y
  32. #include <linux/sysctl.h>
    ( |! x" a5 {- E  g+ M2 K& f
  33. #include <linux/mm.h>
    & R! Z4 o# t" g6 b, B2 u) J
  34. #include <linux/dma-mapping.h>+ g. B7 |' U1 f$ ?  o; q6 G0 D7 D1 j

  35. , u, i# T4 u( _1 S5 \
  36. #include <mach/memory.h>
    # _+ ^& O+ a, @
  37. #include <mach/hardware.h>) A8 u( ^7 u$ _6 q/ ^% q- ?. ~
  38. #include <mach/irqs.h>( {1 u9 Y: t- D" k: o# v
  39. #include <asm/hardware/edma.h>
    , c+ C/ k+ U1 K( L- Y, w; i+ y
  40. % D8 o) W0 h; e+ [8 z. \
  41. #undef EDMA3_DEBUG! {" J: n9 a- D/ u
  42. /*#define EDMA3_DEBUG*/
    " P3 |: ~# j) |
  43. ! u# E2 Z5 C) R: Y' Q) H7 Q: \1 H
  44. #ifdef EDMA3_DEBUG+ I% p& h0 ^7 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 |. {; M# ]( D; R5 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Z$ `& `7 G2 }( M) r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 U+ O8 U- M4 _5 U( g
  48. #else
    4 z6 ^! A. J$ ~% G
  49. #define DMA_PRINTK( x... )( A, v  R$ p4 j' w% N1 Z4 ?( T; }( t
  50. #define DMA_FN_IN
    ; e$ W3 {& V: D
  51. #define DMA_FN_OUT
    & W& o- P7 c; b, \
  52. #endif
    " q% [  K/ v2 ?) Q7 q3 d

  53. 8 H3 m2 F) U; H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 T6 v* i3 t+ Y. X
  55. #define STATIC_SHIFT                31 r6 J5 v1 r/ V9 n6 T
  56. #define TCINTEN_SHIFT               20
    ) V# ~" h1 K: W: v+ J: R
  57. #define ITCINTEN_SHIFT              21
    4 ^" G8 i8 S2 }
  58. #define TCCHEN_SHIFT                22, L& ~9 `( H8 \$ h% U9 x6 _& ?9 K
  59. #define ITCCHEN_SHIFT               23
    . [0 h: B8 e6 H4 f" o# V
  60. / G0 J" r/ N9 e) g5 [2 n
  61. static volatile int irqraised1 = 0;
    ; g8 v' @2 S1 p, w, z
  62. static volatile int irqraised2 = 0;
    - W, _! J4 w4 e; P# w. N' d* s2 |

  63. 7 v( J8 R7 f9 s% q$ }8 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K" |; i  {2 c* y+ X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 v$ J3 M) Q$ L9 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" p$ o  s2 f6 H

  67. * g% e; ~2 \" [! j. i) X, Z
  68. dma_addr_t dmaphyssrc1 = 0;( {  {5 V( x6 F: n2 ?- m# L, |, a
  69. dma_addr_t dmaphyssrc2 = 0;
    2 i( A& H& p" ^+ }0 ^/ }
  70. dma_addr_t dmaphysdest1 = 0;
    + g  m0 U) i4 B1 V7 {2 G9 [' |3 @
  71. dma_addr_t dmaphysdest2 = 0;
    ; u# A# Q2 w# s
  72. ' I/ i0 ^6 q% z
  73. char *dmabufsrc1 = NULL;' a2 ]. S$ J7 Q
  74. char *dmabufsrc2 = NULL;
    ' t+ u/ [5 \, H* @  Y- j
  75. char *dmabufdest1 = NULL;
    ( f. o7 E: F. Y5 L0 D9 B9 V
  76. char *dmabufdest2 = NULL;
    / d" P+ O4 F* G
  77. 0 Q( S5 }- g* H  t- R' w  L! X
  78. static int acnt = 512;
    + f+ r' ]7 o; U: a6 E
  79. static int bcnt = 8;
    " d; _1 W2 H9 W+ N
  80. static int ccnt = 8;$ d8 |0 \0 N: i5 u% m
  81. 7 P) R: c5 X5 y. j; L' u
  82. module_param(acnt, int, S_IRUGO);
    $ O, A3 S2 a4 J* i' i8 @  F
  83. module_param(bcnt, int, S_IRUGO);
    ( F3 j% s; z" E  W( V+ }; t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 W0 ~) Q( n  ?7 t) A/ @; G0 H
6 f& ^% Z4 p' H8 o5 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ?/ R" @# b1 Y4 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 ^# d( M7 z4 g% D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  I: i. T4 w* V2 m$ C/ _4 f/ r- @  c+ N4 {, L  R0 g

$ c/ d8 D; X5 G# k4 @- s; _$ ~% Y) \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 16:59 , Processed in 0.044926 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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